Projects / Immutable Collections for Java

Immutable Collections for Java

Immutable Collections for Java is a library providing immutable/persistent collection classes for Java. While collections are immutable, they provide methods for adding and removing values by creating new modified copies of themselves. Each copy shares almost all of its structure with other copies, to minimize memory consumption. The library includes a singly-linked (cons/cddr style) list/stack, an integer tree-based indexed list, a 2-3 tree-based random access indexed list, a 2-3 tree-based map, a hash tree-based map, and hash- and tree-based sets. All collections provide immutable Cursor as well as standard Iterator classes for looping through all elements. A utility class provides functional style algorithmic processing of Cursors, including foldLeft, foldRight, collect, select, and reject. The 2-3 tree and integer tree classes are optimized for performance and can be used alongside java.util Collections when immutability is needed for safe data sharing.

Tags
Licenses
Operating Systems
Implementation

Recent releases

  •  12 Apr 2014 21:26

    Release Notes: This release improves performance and reduces the memory footprint of hash maps and sets. It also allows use of Cursors in foreach loops.

    •  02 Mar 2014 01:16

      Release Notes: This release provides significant performance enhancements in hash maps and insert order maps. It also adds a new JImmutableArray interface and implementation, providing memory-efficient sparse arrays.

      •  17 Feb 2014 22:31

        Release Notes: Adds a JImmutableMap class whose Cursor iterates over elements in the order that they were originally inserted into the map. This is similar to Java's LinkedHashMap. Assign and delete are slower on these maps, but iteration is similar to a sorted map. Adds JImmutableListMap. These are maps whose values are JImmutableLists. They allow storage of more than one value per key. Other variations include sortedListMap() and insertOrderListMap(). Curry has more factory methods for currying function objects. Also adds new static helper methods to Curry, Tuple*, and Functions classes.

        •  28 Nov 2013 00:26

          Release Notes: Adds new Tuple and Func classes. Has some performance optimizations in the construction of JImmutableLists from other collections.

          Screenshot

          Project Spotlight

          OpenStack4j

          A Fluent OpenStack client API for Java.

          Screenshot

          Project Spotlight

          TurnKey TWiki Appliance

          A TWiki appliance that is easy to use and lightweight.