https://kotlinlang.org logo
#stdlib
Title
# stdlib
p

passsy

03/25/2019, 4:36 PM
Here's a question for the language designers: On on hand kotlins collections have extensions like
toList
or
toMap
. On the other hand
asSequence
and
asIterable
. From my testing the
to
methods copy the collection where the
as
methods create views on the data. Which means if the collections changes, the views also have access to the mutated data. Is this a not documented rule? Would it be "wrong" if one of my own
asCustomList
copies the data instead of creating a view? Should I call it
toCustomList
?
i

ilya.gorbunov

03/25/2019, 4:42 PM
We stick to this convention when naming new functions in stdlib.
5 Views