Version 2.4.0
This release is focused on performance improvements.
Bulk List Inserts
JImmutableList and JImmutableRandomAccessList have various methods for inserting entire collections of objects into a list. These methods include insertAll(), insertAllFirst(), and insertAllLast() that accept Iterator, Cursor, Iterable, etc methods. This release optimizes many of these operations for better performance.
- Any insert operation that adds multiple values at once (i.e. from a collection, cursor, iterator, etc) to either the front or back of a JImmutableList or to the back of a JImmutableRandomAccessList.
- Stream collectors created using factory methods (see below) to build a new list from a stream.
- Deserializing JImmutableList and JImmutableRandomAccessList objects.
Stream Collector Factory Methods
New static factory methods have been added to JImmutables to simplify creation of collectors that build up new collections from a stream:
JImmutables.listCollector()JImmutables.ralistCollector()JImmutables.arrayCollector()JImmutables.setCollector()JImmutables.sortedSetCollector()JImmutables.insertOrderSetCollector()JImmutables.multisetCollector()JImmutables.sortedMultisetCollector()JImmutables.insertOrderMultisetCollector()
The old collector creation methods on list instances themselves do not use the faster logic so use of these new factory methods is encouraged unless you need to append to a non-empty list.
Useful Links
Project Wiki
Collections Overview
Project Javadoc
Maven Coordinates
<dependency>
<groupId>org.javimmutable</groupId>
<artifactId>javimmutable-collections</artifactId>
<version>2.4.0</version>
</dependency>