brk
05/10/2017, 12:20 PMimport kotlinx.coroutines.experimental.*
fun main(args: Array<String>): Unit {
runBlocking {
delay(1000)
println("hello world")
}
}
got this lol:brk
05/10/2017, 12:21 PMimage.png▾
brk
05/10/2017, 12:23 PMorangy
tapchicoma
05/10/2017, 1:15 PMattributes.forEach { name, value -> attribute(name, value) }
where attributes
is mapOf<String, String>()
. But when app running this code I got ClassNoDefFoundError
exception.
When I changed to attributes.forEach { entry -> attribute(entry.key, entry.value) }
everything works ok
Is it a bug in Kotlin?miha-x64
05/10/2017, 1:16 PMmiha-x64
05/10/2017, 1:17 PM{ (key, value) ->
tapchicoma
05/10/2017, 1:17 PMmohsenoid
05/10/2017, 1:17 PMtapchicoma
05/10/2017, 1:17 PMmiha-x64
05/10/2017, 1:19 PMquiro
05/10/2017, 1:26 PMmrtreinis
05/10/2017, 4:24 PMfoo?.let {}
that allows to run block if not null. Is there a similar syntax to run block if is null?elizarov
05/10/2017, 4:26 PMfoo ?: run {}
mrtreinis
05/10/2017, 4:30 PMmrtreinis
05/10/2017, 4:32 PMelizarov
05/10/2017, 4:33 PM?:
reads like "or else"poohbar
05/10/2017, 7:29 PMnew MyPerson.Builder().name("Jack").age(40).build()
kevinmost
05/10/2017, 7:31 PMpoohbar
05/10/2017, 7:34 PMandrioli
05/10/2017, 7:40 PMcedric
05/10/2017, 7:56 PMapply
mitigates the builder pattern to some extent:
Window().apply {
height = 200
width = 200
}
but the Builder pattern can still be useful if you don’t want to construct an instance before validating its init parameterspoohbar
05/10/2017, 7:57 PMdiesieben07
05/10/2017, 7:57 PMpoohbar
05/10/2017, 7:57 PMdiesieben07
05/10/2017, 7:57 PMcedric
05/10/2017, 7:57 PMpoohbar
05/10/2017, 7:58 PMdiesieben07
05/10/2017, 8:00 PMinvoke
methods on the companion object which then delegate to the constructor. But I am not sure