user
03/23/2017, 1:56 PMorangy
03/23/2017, 3:57 PMnimtiazm
03/23/2017, 4:32 PMkrotki
03/23/2017, 5:55 PMzak.taccardi
03/23/2017, 8:06 PMsealed class
when
statement, when used within an rx stream?
ex:
private val handleDealOperation: (DealOperation) -> State.Change = {
operation ->
when (operation) {
//how to enforce type safety? `DealOperation` is a sealed class
}
}
Trying to be typesafe in the context of an rx stream.
source.map(handleDealOperation)
jw
03/24/2017, 7:02 AMbeholder
03/24/2017, 10:52 AMcy
03/24/2017, 2:14 PMmiha-x64
03/24/2017, 5:00 PMoperator fun <T> T.plus(collection: Collection<T>): List<T> {
val result = ArrayList<T>(collection.size + 1)
result.add(this)
result.addAll(collection)
return result
}
semoro
03/24/2017, 6:51 PMoperator fun <T> FieldDelegate.getValue(thisRef: Any?, property: KProperty<*>): T {
@Suppress("UNCHECKED_CAST")
return when(property.returnType) {
String::class -> ""
Int::class -> 42
else -> null
} as T
}
Also please start class names with uppercase 😊Chris Miller
03/24/2017, 8:41 PMjohnl
03/25/2017, 7:23 AMdeviant
03/25/2017, 11:49 AMnotNull()
delegate for just marking property as non null instead of lateinit. lateinit
is rather a hack that exposes public field for easier dependency injection via frameworks such as Dagger, Spring etc.darkmoon_uk
03/26/2017, 7:23 AMnimtiazm
03/26/2017, 9:09 AMsreich
03/26/2017, 5:07 PMs?.exit?.let { it() }
says "the expression can't be a selector (occurs after the dot)"
edit: nvm that one works, IDEA just wasn't refreshing it as a not-erroryawkat
03/26/2017, 7:56 PMevanchooly
03/27/2017, 12:49 AMneverwintermoon
03/27/2017, 9:52 AMmikehearn
03/27/2017, 1:27 PMxenomachina
03/27/2017, 6:04 PMdylan.graham
03/28/2017, 3:15 AMilya.gorbunov
03/28/2017, 8:20 AMsreich
03/28/2017, 10:00 AMlouiscad
03/28/2017, 12:21 PMhashCode()
is implemented by the Kotlin compiler in a data class
having a `fun`ction property constructor parameter? e.g.: data class Option(val id: Int, val desc: () -> String)
andre.figas
03/30/2017, 11:52 AMorangy
03/30/2017, 12:24 PMkirillrakhman
03/30/2017, 1:45 PMmzgreen
03/31/2017, 8:01 AMcase
but it seems that java does not (or it allows to create a package but it can’t compile files in there because case
is a keyword). So when I created a case
package in Kotlin and then tried to compile the project I got the error saying that `expected indentifier in line 1`(package name) in stub class. I guess this is a bug?bitkid
03/31/2017, 9:17 AMbitkid
03/31/2017, 9:17 AMsemoro
03/31/2017, 9:58 AM-Xmx
of IDEAbitkid
03/31/2017, 10:06 AMkingsley
03/31/2017, 10:11 AMidea64.vmoptions
?bitkid
03/31/2017, 11:00 AM