Getting started with Kotlin's collection classes


Read this post from the bottom up; the editor is placing new-lines in the wrong place...

The “Unresolved reference: MutableSet” type errors don’t help any in working this out (saying “MutableSet is a trait; objects can only be created from non-abstract classes” would be so much clearer).

It seems that jet.MutableSet is a trait which is satisfied by java.util.TreeSet, etc. Is the only point to expose a Kotlin-ised API and make usage of immutable containers (or at least mutable containers hidden behind immutable interfaces) easier?

Where is the documentation for Kotlin’s collection classes? They’re not mentioned in the API documentation nor much in any other documentation that I can see.


So far there are no Kotlin-specific containers, we rely on the ones available from Java for the time being. Kotlin will provide its own containers (or reuse immutable containers from other libraries), but it is not done yet.


Perhaps I can help.

I have a library containing, among other things, immutable data types such as lists, trees, sets, maps, etc. as well as
option and either type. The library is pure Kotlin. I have developed tests for them and they seem reasonably robust. They
have then been used to develop other Kotlin libraries. It would be good to have another pair of eyes scrutenize them.