mg6maciej
04/27/2017, 2:12 PMwouterdoeland
04/27/2017, 4:09 PMcurioustechizen
04/27/2017, 4:12 PM!!
- while valid here because I checked for null before, doesn't seem idiomatic to mekevinmost
04/27/2017, 4:16 PMthing?.takeIf { anotherCondition }?.run(::doSomething)
I believe would workuujava
04/27/2017, 4:33 PMmg6maciej
04/27/2017, 8:58 PMsnowe
04/27/2017, 9:45 PMval events= mapOf(
Pair("Applicant Created", { projector.handle(applicantCreatedEvent()) }),
Pair("Property Registered", { projector.handle(propertyRegisteredEvent()) }),
mg6maciej
04/27/2017, 9:52 PMCzar
04/28/2017, 7:01 AMclass Projector {
fun <T:LoanTransactionEvent> handle(event: T) {
event.handleWith(this)
}
}
interface LoanTransactionEvent {
default void handleWith(Projector projector) {
// your event-specific stuff here
}
}
And now you can call it in the loop exactly as @snowe wanted. (I was too lazy to test, so there may be some mechanical errors).chris-hatton
04/28/2017, 8:36 AMdmitriy.govorukhin
04/28/2017, 2:23 PMxenomachina
04/28/2017, 6:19 PMyoavst
04/29/2017, 10:49 AMmibac
04/29/2017, 5:14 PMClass
)snrostov
04/29/2017, 5:59 PMprintln(""" $d """)
how escape $?
this doesn't work: println(""" \$d """)
chris-hatton
04/30/2017, 6:38 AMisInterface
equivalent.kkozmic
04/30/2017, 8:37 AMkkozmic
04/30/2017, 12:05 PMorangy
04/30/2017, 5:31 PMpniederw
05/01/2017, 1:57 AMdeepanshu
05/01/2017, 9:21 AM(0..listA.size - 1).filter{ listA[it] < listB[it] }.forEach { return true}; return false
as a result of intention action to fix "LoopToCallChain` warning on the following loop:
for (i in 0..listA.size - 1) if (listA[i] < listB[i]) return true; return false
The bytecode in the IDE of former snippet shows creation of additional objects, and more importantly, running the comparison for the full list, rather than returning early. Does the compiler at build time optimize it?mg6maciej
05/01/2017, 12:13 PMDaniel
05/01/2017, 12:14 PMorangy
05/01/2017, 6:11 PMlouiscad
05/01/2017, 8:56 PM//TODO
comments?groostav
05/02/2017, 5:37 AMmarcinmoskala
05/02/2017, 7:30 AMmg6maciej
05/02/2017, 8:10 AMfun x(aFunc: A.(file: File) -> Unit) = Unit
x { it.blah() }
should also this compile?
x(File::blah)
dimsuz
05/02/2017, 11:53 AMzak.taccardi
05/02/2017, 3:55 PMzak.taccardi
05/02/2017, 3:55 PMmg6maciej
05/02/2017, 3:56 PMzak.taccardi
05/02/2017, 3:56 PMmg6maciej
05/02/2017, 3:57 PM