dmitry.petrov
12/06/2017, 3:16 PMkarelpeeters
12/06/2017, 3:17 PMdmitry.petrov
12/06/2017, 3:20 PMdmitry.petrov
12/06/2017, 3:23 PMkarelpeeters
12/06/2017, 3:23 PM..
still compiles down to an index-based for loop, right?dmitry.petrov
12/06/2017, 3:24 PMuntil
;)dmitry.petrov
12/06/2017, 3:26 PMindices
. Or a range with const upper bound)dmitry.petrov
12/06/2017, 3:28 PMdmitry.petrov
12/06/2017, 3:29 PMelect
12/06/2017, 3:31 PMindices
isn't gonna allocate something?dmitry.petrov
12/06/2017, 3:41 PMin
operator, and not in for
. Otherwise - yes, all these operations will allocate a range insuranceelect
12/06/2017, 8:25 PMkirillrakhman
12/07/2017, 8:22 AMholgerbrandl
12/08/2017, 2:07 PMwhen
bind its argument to it
? It would make when
so much more useful and readable. I mostly end up with just when{ ...}
marstran
12/08/2017, 2:14 PMlist.forEach {
when (foo) {
1 -> println(it)
}
}
holgerbrandl
12/08/2017, 2:26 PMcbruegg
12/10/2017, 11:33 AMnatpryce
12/10/2017, 1:44 PMnatpryce
12/10/2017, 1:46 PMsequenceOf(1,2,3,4,5).takeUntil{it == 3}
which would return sequenceOf(1,2,3)
kevinmost
12/10/2017, 2:15 PMtakeWhile
, you can do takeWhile { it != 3 }
natpryce
12/10/2017, 2:42 PMnatpryce
12/10/2017, 2:44 PMzipWithNext().takeWhile { (prev,next) prev != 3 }.map { it.first }
natpryce
12/10/2017, 2:45 PMilya.gorbunov
12/11/2017, 3:39 AMtakeWhile
and tracking whether the last item was found with a mutable boolean in a lambda.
You could file a feature request though.asad.awadia
12/12/2017, 1:55 AM{1,3,2,4,3,5
} should return {1,3}
or {1,3,2,4,3}
?asad.awadia
12/12/2017, 2:01 AMnumList.minus(numList.takeLastWhile { it != 3 }))
natpryce
12/12/2017, 10:08 AMnatpryce
12/12/2017, 10:09 AMjw
01/08/2018, 9:37 PMMutableMap.getOrPut
use V : Any
for the value generic type?jw
01/08/2018, 9:37 PM