https://kotlinlang.org logo
#announcements
Title
# announcements
r

rgrasell

09/20/2019, 1:58 AM
In the kotlinx immutable collections library (https://github.com/Kotlin/kotlinx.collections.immutable), what is the difference between the persistent classes vs immutable classes?
Copy code
Persistent collections: PersistentList, PersistentSet, etc. They extend immutable collections and provide efficient modification operations that return new instances of persistent collections with the modification applied. The returned collections can share parts of data structure with the original persistent collections.
So I guess my next question is why do the immutable collections exist at all? It sounds like persistent is a straight upgrade.
g

gildor

09/20/2019, 2:25 AM
immutable collections are immutable and do not provide any modification operations
🙏 2
r

rgrasell

09/20/2019, 2:27 AM
This library must have changed since last time I used it. My recollection of the immutable classes is how the persistent ones behave now. Thanks you@
g

gildor

09/20/2019, 2:28 AM
yes, it’s essentially reimplemented from scratch interfaces and implementations
old version of interfaces was not work well with existing Kotlin extensions for collection modification
👍 1
3 Views