Thread
#stdlib
    p

    passsy

    3 years ago
    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
    ?
    ilya.gorbunov

    ilya.gorbunov

    3 years ago
    We stick to this convention when naming new functions in stdlib.