The Eclipse Collections API
Eclipse Collections has a very feature rich API. If you ever wished a Java Collection could do something more “collection-like”, Eclipse Collections probably has a method that does it. The following blog has a mind-map of the methods available on the Eclipse Collections API.
Visualizing Eclipse Collections
A visual overview of the APIs, Interfaces, Factories, Static Utility and Adapters in Eclipse Collections using mind…
Visualizing the Results
You can try and debug the results above in your mind, but I thought it would be more helpful if I just showed you the results inline using IntelliJ.
My Top 25 List
The 25 methods I highlighted are linked to their JavaDoc, with descriptions and links to separate supporting blogs where available.
- with / of — Collection factory methods
- collect — Transform a collection from one type to another
- select / reject — Filter a collection inclusively and exclusively
- count — Count elements based on a predicate
- any / all / noneSatisfy — Short-circuit methods with Predicates
- groupBy — Group elements based on a Function
- countBy — Count elements by a Function
- makeString — Convert a collection to a String using separators
- toImmutable — Convert a collection to an immutable equivalent
- asLazy — Create a lazy view on the collection
- containsBy — Check containment of a value based on a Function
- detectWith — Find the first element that matches a Predicate
- detectWithIfNone — Same as detectWith, but handles case of none
- injectInto — Continuum Transfunctioner
- partition — Splits a collection based on Predicate
- chunk — Breaks a collection into chunks based on a size
- sumByInt — Sums a collection by a key Function and int value
- collectInt — 8 primitive versions of collect
- flatCollectChar — 8 primitive versions of flatCollect
- asParallel — returns a performant Lazy ParallelIterable
- distinct — Returns the distinct values in a List
Why both with and of?
If you’re wondering why Eclipse Collections has both
of methods on the factory classes, the following blog explains in detail.
Do you already know Java Streams?
This article will help you leverage your knowledge of Java Streams to learn the Eclipse Collections API.
Refactoring to Eclipse Collections: Making Your Java Streams Leaner, Meaner, and Cleaner
Eclipse Collections is a high performance collections framework for Java, adding rich functionality to the native JDK…
I am a Project Lead and Committer for the Eclipse Collections OSS project at the Eclipse Foundation. Eclipse Collections is open for contributions. If you like the library, you can let us know by starring it on GitHub.