As you might notice on this slide, there are currently missing primitive collection types. There are no BiMap, Multimap, SortedBag, SortedSet, SortedMap types for primitives today. That can change over time, if folks have a specific need. We only add types to Eclipse Collections when there is a real need.
Why no primitive Boolean<V>Map?
The type Map<Boolean, V> in Java has a particular design smell. We specifically designed the primitive collection types in Eclipse Collections so there are no BooleanObjectMap<V> type or Boolean<Primitive>Map types.
Disallowing this kind of type may seem like a poor design decision to folks who enjoy Map-Oriented Programming. After all, the the Collectors.partitioningBy() method returns Map<Boolean, List<T>>, so it must be a good design right? Not all questions have a simple answer, so some questions deserve an entire blog.
In modern versions of Java (Java 17+ for LTS users), you can use a Java record to create a concise strong type for what might be considered more generally as a Pair. Eclipse Collections also has Pair, and all combinations of primitive and object Pair types (e.g. IntObjectPair, ShortBytePair, LongBytePair, etc). These are better, safer alternatives to using a Map<Boolean, V> type.
What about primitive support for lambdas?
Eclipse Collections has had primitive collection support since before Java had lambdas (around 2012). Just like the object collections in Eclipse Collections, the primitive collections were designed with a feature rich API. I knew Java would get lambdas eventually, I just wasn’t sure when exactly.
By the time we added primitive collection support to GS Collections, I believed Concise Lambda Expressions would be included in Java 8. The fundamental problem with lambda support for primitives is the same as collections support for primitives. There is no support for Generic Types over Primitives in Java today. This is a feature that may eventually arrive with Project Valhalla.
My ten year quest for lambda support in Java has been absolutely dwarfed by my twenty-one year wait for generic types over primitives.
I shared what I have been wishing and waiting for in Java in this blog.
TL;DR… This is what it looks like when you decide to stop wishing or waiting, and just get to work making a Functional Interface named Procedure/Procedure2 (aka Consumer/BiConsumer) work for the primitive types. This is only one of three Functional Interface type categories. There are also Function0/Function/Function2 and Predicate/Predicate2. The combinatorial explosion of these types is explained further in the blog and the “Eclipse Collections Categorically” book.
Blogs, Code Katas, and other Resources
If you are interested in learning more about the primitive collection support in Eclipse Collections, the following resources can help.
Blogs
Code Katas
Lost and Found Kata in Eclipse Collections Kata repo. There is a solutions folder for this kata as well.
Book
The book “Eclipse Collections Categorically: Level up your programming game” was first published in March 2025. The book has excellent coverage of working with both object and primitive collections in Eclipse Collections. Various versions of the book are linked from the publisher here. The book is also currently available for free to Amazon Kindle Unlimited subscribers.
Reference Guide
There is an AsciiDoc Reference Guide for Eclipse Collections with a dedicated section on primitive collections here.
Final Thoughts
The extensive primitive collections support in Eclipse Collections has been one of its most popular features. The combination of primitive collections with lambda-enabled API and support for mutable and immutable types is unmatched in any other Java collections library. These are hard problems to solve, but they have been solved problems in Eclipse Collections for well over a decade.
It will be great when Project Valhalla is finally realized and released in Java. Maybe you can afford to wait for Project Valhalla to arrive and finally build the applications and libraries you really want to build. I’m glad we got to work on supporting primitive collections in Eclipse Collections when I was in my early forties. Now I’m in my mid-fifties, and I have decided I’m getting too old to wait for language miracles to arrive.
Java has been good enough since Java 8, and gets better with every release. I go primitive any time I need to. I don’t need to wait for anything.
You can either get to work using what’s available today, or wait and hope for someone to eventually unbox the box you’ve been travelling in. Go primitive in Java, or go in a box. Your choice.
Thanks for reading!
I am the creator of and committer for the Eclipse Collections OSS project, which is managed at the Eclipse Foundation. Eclipse Collections is open for contributions. I am the author of the book, Eclipse Collections Categorically: Level up your programming game.