dimsuz
08/26/2016, 3:43 PMdean
08/27/2016, 12:20 PMlist1.map { it.id }.intersect(listOfIds)
drfriendless
09/06/2016, 4:46 AMkirillrakhman
09/06/2016, 6:48 AMtoMutableX
extension functions?jw
09/06/2016, 3:07 PMorangy
toMutableX
yet, but there is a plan to include some. Also there is mutableListOf
to create mutable list right away.ilya.gorbunov
09/07/2016, 9:33 AMtoMutableList
and toMutableSet
in 1.0. And there is no toMutableMap
which is coming in 1.1hinst
09/13/2016, 10:32 AMvoddan
09/13/2016, 11:05 AMkirillrakhman
09/15/2016, 9:00 AMIterable
?kirillrakhman
09/15/2016, 9:03 AMfun <T> Iterable<T>.itemAfterOrNull(item : T) : T? {
val iter = iterator()
while (iter.hasNext()) {
if (iter.next() == item) return if (iter.hasNext()) iter.next() else null
}
return null
}
orangy
orangy
list.dropWhile { !cond }.firstOrNull()
but it’s copyingkirillrakhman
09/15/2016, 12:17 PMilya.gorbunov
09/15/2016, 1:48 PMfirstOrNull { }
and hold the state (whether item
was met) in the closure.kirillrakhman
09/15/2016, 2:48 PMilya.gorbunov
09/15/2016, 3:55 PMkotlin.jvm.internal.Ref
-wrappers? Vote for the issue https://youtrack.jetbrains.com/issue/KT-5248kirillrakhman
09/15/2016, 5:12 PMvoddan
09/16/2016, 6:32 PMdrfriendless
09/17/2016, 7:35 AMyole
09/17/2016, 7:46 AMif (i in map) return map[i]; throw RuntimeException("not found")
drfriendless
09/17/2016, 12:55 PMyole
09/17/2016, 1:13 PMmap[i] as T
drfriendless
09/17/2016, 1:15 PMvoddan
09/19/2016, 8:54 AMfind
and firstOrNull
with identical semantics :
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/first-or-null.html
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/find.htmlvoddan
09/19/2016, 8:55 AMfirstOrNull
since it is more explicit and more kotlin-ishvoddan
09/19/2016, 8:56 AMfind
then with a message telling devs to use firstOrNull
instead ?voddan
09/19/2016, 8:56 AMvoddan
09/19/2016, 8:57 AMThere should be one-- and preferably only one --obvious way to do it.
yole
09/19/2016, 8:57 AM