miha-x64
04/17/2017, 1:28 PMconst val
or not?miha-x64
04/17/2017, 7:12 PMfor (x in a until b)
ever optimized by compiler?s.luhmirins
04/18/2017, 9:43 AMmiha-x64
04/18/2017, 6:16 PMevkaky
04/19/2017, 1:51 PMteedee
04/19/2017, 2:16 PMgermangb
04/19/2017, 8:26 PMroberto.guerra
04/20/2017, 4:56 PMbeholder
04/20/2017, 10:23 PM@XStreamAlias
annotations attached to Kotlin data classescodematix
04/21/2017, 8:47 AMpoohbar
04/23/2017, 12:48 PMclass Test() {
var l: List<Int> = mutableListOf()
init {
l.add(4) // Unresolved
}
}
miha-x64
04/24/2017, 10:49 AMcontrols.mapValues {
val ans = EnumSet.noneOf(NotificationTarget::class.java)
if (it.value.pushSwitch.isChecked) ans += NotificationTarget.PUSH
if (it.value.emailSwitch.isChecked) ans += NotificationTarget.EMAIL
ans
}
miha-x64
04/24/2017, 4:03 PMvar user = state.user
sendToBackend(diff.mapValues { when (it.key) {
"name" -> (it.value as String).also { user = user.copy(name = it) }
"sex" -> ((it.value as Sex).also { user = user.copy(sex = it) }).name
"birth" -> ((it.value as Calendar).also { user = user.copy(birth = it.time) }.timeInMillis / 1000L).toString()
else -> throw AssertionError()
} })
ahdezma
04/25/2017, 1:20 PMval errors = torrent.error?.let { listOf(it) }
elect
04/26/2017, 5:19 PMjava.lang.AbstractMethodError
indicate?chuck
04/26/2017, 6:23 PMRuckus
04/27/2017, 3:36 AMRemove(List)
. You could resolve it by giving them separate JVM names, but for more clarification on that, you should check SO. 😒tackoverflow:dcsg
04/27/2017, 2:29 PMfirezenk
04/28/2017, 2:17 PMCar
and I’ve to pass it to a function that accepts vararg but it says the time that needs si `Nothing!`… but in Java is getting the correct type, any suggestions?brianwernick
04/28/2017, 2:46 PMpublic void callingMethod(TestInterface interface)
to fun callingMethod(lambda: (string) -> String)
kojdecki
04/28/2017, 2:56 PMinterface TestInterface {
fun apply(str: String): String
}
fun TestInterface(lambda: (String) -> String): TestInterface {
return object : TestInterface {
override fun apply(str: String): String = lambda(str)
}
}
fun main(args: Array<String>) {
var test = TestInterface { str: String -> str.apply { println(str) } }
test.apply("test")
}
You can throw some inlines in there.danneu
04/28/2017, 7:05 PMjava.lang.NoClassDefFoundError: com/beust/klaxon/Parser
on this line: https://github.com/danneu/reddit/blob/master/src/main/kotlin/com/danneu/reddit/extensions.kt#L44
i'm not very experienced in java/kotlin, any pointers on what might cause this when using a library from another project?gauravm8
04/29/2017, 5:31 PMarve
04/29/2017, 5:34 PMMyClass(groupId, datetime, someValue)
Next, I have a Set<MyClass>
, which can contain multiple entries with the same groupId. I want to turn this into a Set<MyClass>
that contains the latest(by datetime) entry for each groupId. What’s a good functional/stream-like way of achieving this?pserzh
04/29/2017, 8:09 PMtylerwilson
05/02/2017, 2:15 AMMoe
05/02/2017, 1:10 PMelect
05/02/2017, 4:58 PMinit{ }
?elizarov
05/04/2017, 7:09 AMCharacter.digit(ch: Char, radix: Int)
, so you can simply do it straight away with:
fun String.calc() = map { Character.digit(it, 10) }.reduce(Int::times)
cedric
05/04/2017, 6:50 PMcedric
05/04/2017, 6:50 PMRuckus
05/04/2017, 7:07 PMThrowable
).cedric
05/04/2017, 8:07 PMRuckus
05/04/2017, 8:09 PMcedric
05/04/2017, 8:12 PMRuckus
05/04/2017, 8:26 PM