user
10/02/2018, 9:22 AMFré Dumazy
10/02/2018, 11:50 AMpablisco
10/02/2018, 12:29 PMget
?miha-x64
10/02/2018, 8:31 PMkotlinc
generates somePropertyName$annotations()
with annotations instead of putting them onto the backing field?..Hexa
10/02/2018, 11:56 PMError:(33, 76) Kotlin: Unresolved reference: messageIndex
in this line here? https://gist.github.com/rinnegan/878a8451bbae54441a588e75a5acbacd#file-group-by-messageindex-L33 . I want to group by MessageIndex
. Code does not work if I remove val messageIndex: MessageIndex
from this class data class MessageSender(
val message: String
//, val messageIndex: MessageIndex
)
hamid.s
10/03/2018, 7:02 AMBorzdeG
10/03/2018, 11:59 AM> Task :hello-other-common:jar
e: .../hello-other-jvm/src/main/kotlin/hello/other/jvm/HelloOtherData.kt: (3, 21): Unresolved reference: HelloCommonData
e: .../hello-other-jvm/src/main/kotlin/hello/other/jvm/HelloOtherData.kt: (5, 48): Unresolved reference: HelloCommonData
> Task :hello-other-jvm:compileKotlin FAILED
At the same time, there are no errors in IDEA - only during the execution of the code.Hamza
10/03/2018, 2:11 PMhallvard
10/03/2018, 2:34 PMSlackbot
10/03/2018, 3:32 PMHexa
10/03/2018, 3:34 PMList<Pair<PublisherMessage, deviceType>>
. It currrently only returns emailMesssages: List<MessageSender>
wei
10/03/2018, 4:44 PMkeys
and another map of key -> value map
, whose keys are a subset of keys
and whose value is either SOFT_DELETED
or NOT_DELETED
. For example:
val keys = listOf("key1", "key2", "key3")
val map = mapOf("key1" to "SOFT_DELETED", "key2" to "NOT_DELETED")
I need to combine keys
and map
to generate another map finalMap
, whose keys will contain all keys from keys
that are not in keys of map
with values of DELETED
and keys of map
that has a value of SOFT_DELETED
. In the above example, I’d have:
val finalMap = mapOf("key1" to "SOFT_DELETED", "key3" to "DELETED")
I can think of mapping over keys
and check each key against map
and generate finalMap
, like:
val finalMap = keys.mapNotNull {
when(map[it]) {
"SOFT_DELETED") -> it to "SOFT_DELETED"
null -> it to "DELETED"
else -> null
}
}
Is there a more idiomatic way in kotlin to do this?karelpeeters
10/03/2018, 4:55 PMkeys.associate { it to "DELETED" } + map.filter { (k, v) -> v == "SOFT_DELETED" }
Mike
10/03/2018, 5:47 PMSlackbot
10/03/2018, 6:10 PMValV
10/03/2018, 7:44 PMval parameter: Boolean? by param()
if (parameter != false) ...
instead of
val parameter: Boolean? by param()
if (parameter ?: true) ...
jdemeulenaere
10/03/2018, 7:56 PMdigitalsanctum
10/03/2018, 10:01 PMViral Thakker
10/04/2018, 6:21 AMmolikto
10/04/2018, 7:15 AMqwert_ukg
10/04/2018, 8:34 AMrender
function into my API file and don't want to provide an possibility to call it from builderBernhard
10/04/2018, 10:37 AMbod
10/04/2018, 11:55 AMwhen (e)
, (with e being an instance of MyEnum
) and for the branches, I’m allowed to put something that is not one of the possible values of MyEnum
(I can put values of other enums). I find this extremely surprising 🙂 Thoughts?Uzi Landsmann
10/04/2018, 3:04 PMSam
10/04/2018, 4:08 PMprivate val listener = DialogInterface.OnClickListener { _, _ -> println("interface lambda") }
private val listener1 = BroadcastReceiver { _, _ -> println("abstract class lambda") } // Error cannot create an instance of abstract class
Hexa
10/04/2018, 7:46 PMasSquence
before calling groupBy
on this function that I wrote, but I can't find any evidence to prove if this is a good idea or not. I wonder if anyone here can suggest if this is a good idea. So basically here is what the code look like //BEFORE adding.asSequence()
override fun handle(event: List<String>): Either<Errors.RequestError, Pair<List<Errors.RequestError>, Int>> =
emailParser.parseEmails(event)
.map {
Pair(
first = it.first,
second = it.second
.groupBy { it.emailAdrress }
.map {
Pair(
first = MessageDestination(it.key),
second = it.value.map {
MessageSender(
message = it.environment
)
}
)
}.toMap()
)
}.flatMap { pair ->
service.handleRequests(pair.second)
.map {
Pair(pair.first, pair.second.size)
}
}
//AFTER adding .asSequence()
override fun handle(event: List<String>): Either<Errors.RequestError, Pair<List<Errors.RequestError>, Int>> =
emailParser.parseEmails(event)
.map {
Pair(
first = it.first,
second = it.second
.asSequence()
.groupBy { it.emailAdrress }
.map {
Pair(
first = MessageDestination(it.key),
second = it.value.map {
MessageSender(
message = it.environment
)
}
)
}
.toList().toMap()
)
}.flatMap { pair ->
service.handleRequests(pair.second)
.map {
Pair(pair.first, pair.second.size)
}
}
Hullaballoonatic
10/04/2018, 8:27 PMfoo::class
, and KClass<Bar>
?Dominaezzz
10/04/2018, 8:35 PMval num: UInt = 5
?Sam
10/04/2018, 8:53 PMIntentFilter().apply {
addAction( packageName + INTENT_ACTION_OPEN )
addAction( packageName + INTENT_ACTION_CLOSE )
}.run {
registerReceiver( receiver, this )
}
Hullaballoonatic
10/04/2018, 9:16 PMHullaballoonatic
10/04/2018, 9:16 PMkarelpeeters
10/04/2018, 9:17 PMHullaballoonatic
10/04/2018, 9:18 PMkarelpeeters
10/04/2018, 9:19 PMMike
10/04/2018, 9:20 PMHullaballoonatic
10/04/2018, 9:42 PMMike
10/04/2018, 10:35 PMHullaballoonatic
10/04/2018, 10:38 PMMike
10/04/2018, 11:24 PMHullaballoonatic
10/04/2018, 11:44 PMd
operator in D&D. 1d10+5
. I know infix does that, but I don't like the spaces. We could also create our own mathematical operators like a power operator **
Mike
10/04/2018, 11:57 PMd
out makes parsing take longer. Kotlin is already slower than Java, and a lot of people complain about Scala’s compiler speed.
If you use the language, you stop caring, or don’t notice, but when you’re first starting out…