ilya.gorbunov
07/23/2019, 5:51 PMkotlinx.collections.immutable
library — 0.2
Thanks to the great effort of @Abduqodiri Qurbonzoda [JB] we now have modern and efficient implementations of persistent collections rewritten from scratch. That allowed us to improve performance characteristics of many collection operations. See more details in the changelog: https://github.com/Kotlin/kotlinx.collections.immutable/releases/tag/v0.2
Another notable change is that we have split each collection interface there into two parts: an ImmutableCollection
that merely extends a read-only Collection
and adds a contract of immutability on top of it, and a PersistentCollection
that additionally provides modification operations and builders.
We encourage you to try it and share your feedback, but note that the library is still pre-release, so the API and implementations can change in future.
Currently this library is provided only for JVM, but our next short term plan is turning it into a multiplatform one.Ruckus
07/23/2019, 8:50 PMlistOf
etc. return these instead of using mutable collections under the covers? Or will these stay in kotlinx
?elizarov
07/23/2019, 9:33 PMTom Prior
07/24/2019, 8:14 AMTuan Kiet
07/27/2019, 10:16 AMkarelpeeters
07/27/2019, 1:30 PMList
you promise that you won't modify it, but the caller doesn't promise anything.
For the persistent collections, it's nice to be able to do do things like list1 + list2
and for (x in list1 + extra)
without having terrible performance because of all of the copying.