Eclipse Collections (EC) and its predecessors embraced a functional programming approach for collections long before that became standard in Java 8. EC liberally uses function types (now lambdas) and higher order functions (now provided on the Stream interface). For a couple of years EC and Java 8 had disjoint functional APIs for collections. Now with version 8 (Milestone 1 released on July 6th), EC embraces Java 8 and adds interoperability in multiple ways:
- Updates EC function types to extend their Java counterparts where those exist.
- Provides a large suite of Collector's, which bring EC functionality, including primitive collections, to users of the Java Stream APIs.
- Adds a reduceInPlace() method on its base RichIterable interface, to provide the functionality of Stream.collect() to the EC types which do not extend Collection, and thus do not inherit a stream() method.
- Adds collection methods to produce SummaryStatistics, and methods which return an Optional where that makes sense.
We will briefly review the EC APIs, and then present more detail on these Java 8 additions, their raisons d' être, their actual interfaces, and a touch of their implementation.
Currently EC only provides a serial implementation of its reduceInPlace() method, although it has parallel implementations of most EC collection types. We will review this decision, our plans for adding a parallel version, and the differing approaches to parallel processing in EC and Java 8 Streams.