:mega: :mega: We'd like to announce the second rel...
# announcements
📣 📣 We'd like to announce the second released version of
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
that merely extends a read-only
and adds a contract of immutability on top of it, and a
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.
K 7
👍 5
🎉 24
🍾 3
Is there any plan to have
etc. return these instead of using mutable collections under the covers? Or will these stay in
They will stay in a separate library.
👍 1
@ilya.gorbunov This is so cool! I wrote a blog recently about a quick intro to persistent lists in Kotlin and was talking about how I liked persistent data structures in other languages like Scala and F#. So, this is a really exciting announcement! Thanks so much 🙂
noob question, why this is a good thing?
For the immutable collections, you can require that parameters to your functions are really immutable, and you can freely store them for later use without any defensive copies. If you would just take a
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
for (x in list1 + extra)
without having terrible performance because of all of the copying.