Dexx Collections - Persistent (Immutable) Collections for Java/Kotlin

Greetings all,

I’ve pushed the first release of Dexx Collections ( to Maven Central.

It’s essentially a port of Scala’s core collection classes to pure Java.

While the implementation is pure Java, the classes have been annotated with JetBrains’ @NotNull and @Nullable to make them fairly pleasant to use from Kotlin.

Scala’s collections were the main thing I missed when moving from Scala to Kotlin - so hopefully this will fill the gap for some of you as well.

It’s a first release, so I expect there will be some issues, but the release has been tested fairly extensively (line coverage is around 94% at present).

For those of you not familiar with persisent collections, the key concept is that all references to collections are immutable, but modifications can be made by returning a new collection (which usually shares the bulk of the original collection’s structure).

Here’s an example (set1 remains in the original state despite “modifications”):

val set1 = Sets.of(1, 2, 3)
val set2 = set1.add(4)
val set3 = set1.remove(1)
println(set1) // Prints Set(1, 2, 3)
println(set2) // Prints Set(1, 2, 3, 4)
println(set3) // Prints Set(2, 3)

See for more information.


This is very nice! Thanks.

Cheers Hadi!