Dave Leeds
09/17/2019, 5:18 AMnfrankel
09/17/2019, 7:29 AMcurioustechizen
09/17/2019, 7:59 AMChris Miller
09/17/2019, 9:24 AMDave Leeds
09/17/2019, 12:10 PMnfrankel
09/17/2019, 6:38 PMvoddan
09/18/2019, 8:45 AMCody Engel
09/25/2019, 6:28 PMtoList()
performance hit though.
Would providing a capacity
for toList
offset that performance hit? This is a crude example but something like this is possible today:
listOf<String>().asSequence().map { it }.sorted().toCollection(ArrayList(20))
So adding toList(defaultCapacity: Int)
could clean it up a bit more. Just thinking for cases where the list size isn’t changing it’d be worth it just tell it what size it should beDave Leeds
09/26/2019, 2:14 AMSequence.toList()
. Naturally, you'd still want to take it in context with all of the other factors in play, but if you do know the size, your approach would help tip the scales back toward sequences. 👍Cody Engel
09/26/2019, 1:37 PM