https://kotlinlang.org logo
Title
k

karelpeeters

08/15/2017, 10:21 AM
You can a sequence to avoid creating a temporary
List
if you're going with
forEach
.
👍 1
s

semoro

08/15/2017, 10:24 AM
In Kotlin
Sequence
are preferred way to preform lazy stream operations. As it not required Java 8, and included in Kotlin stdlib. You can obtain sequence from list via
asSequnece()
call like
listOf(1, 2, 3).asSequence()
k

karelpeeters

08/15/2017, 10:24 AM
My bad, thanks!
l

lovis

08/15/2017, 10:25 AM
My brain actually converts
Stream -> Sequence
when I read it, so i didn’t even notice 😅
s

semoro

08/15/2017, 10:26 AM
My too, but this is #getting-started 🙂
👍 1