Join Slack
Powered by
that has to be super ineffecient, right?
# getting-started
u
ursus
09/27/2019, 3:41 AM
that has to be super ineffecient, right?
m
molikuner
09/27/2019, 5:30 AM
https://kotlinlang.slack.com/archives/C0BJ0GTE2/p1568697481011600?thread_ts=1568697481.011600&cid=C0BJ0GTE2
👍 1
t
thanksforallthefish
09/27/2019, 3:47 PM
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.sequences/sorted.html
and
https://kotlinlang.org/docs/reference/sequences.html#sequence-operations
also helps. basically sorted is stateful, so it requires all elements from the sequence anyway.
thanksforallthefish
09/27/2019, 3:48 PM
I had no idea, but you can play around with some code in kotlin docs:
https://kotlinlang.org/docs/reference/sequences.html#sequence
add a
.sortedBy{ println("sort: $it"); 0 }
and you will see all elements being processed in
sortedBy
2
Views
Open in Slack
Previous
Next