Functional/Immutable Data Structures for the JVM?

Viewed 4577

Does anyone know of a Java/JVM data structure library providing functional (a.k.a. immutable, or "persistent" in the functional sense) equivalents of the familiar Java data structures?

By "functional" I mean that the objects themselves are immutable, while modifications to those objects return new objects sharing the same internals as the parent object where appropriate (for efficiency in both time and space; a naïve implementation could just copy the whole thing on every write).

Much like Java's concurrency libraries, this doesn't seem like something I can or should implement myself, so it would be nice to have a functional data structure library I can use in the JVM.

6 Answers

Try Functional Java. It contains immutable maps, sets, lists, and trees. However, this library is much more than just a collection of immutable data structures!

Related