Eclipse Collections provides additional collection types not found in the JDK.

A mind map with branches for Interval, Bag, Multimap, Hashing Strategy, BiMap, Pool, MultiReader and primitive collections.
A mind map with branches for Interval, Bag, Multimap, Hashing Strategy, BiMap, Pool, MultiReader and primitive collections.
Eclipse Collections data structures not found in the JDK

Data structures you won’t find in the JDK

The JDK may not have all of the data structures you need to build your Java applications. In part 1 of this blog series, I will cover several data structures that you will not find in the JDK today, but that are available in Eclipse Collections.

Interval

  • An Interval is a range of Integer values with a from, to, and step value.
  • An Interval is immutable.
  • An Interval may be forward or reverse depending on whether the from is less than…


Learn how to filter specific types in a mixed Java collection

Photo by Alex Chambers on Unsplash

The Problem

Sometimes you have a mixed Collection in Java. A simple example is having a List<Number> , where the list may contain Integer, Float, Long and Double instances. How can you easily filter out the List<Integer> or the List<Double>? I will demonstrate how to do this with classic Java, using Pattern matching for instanceof in Java 16, and using two different approaches with Eclipse Collections. I have also added a preview solution using JDK 17 EA and Pattern Matching in Switch.

Solution: Classic Java

This is one way to solve the problem using…


A poem about time and change.

Building a new boardwalk at Seaside Heights, NJ after Hurricane Sandy — Photo by Donald Raab

Background

This is a very short poem I wrote in 1988 that was published in my high school’s art and literary magazine. I hope you enjoy the poem, and my selection of pictures to go with it.

Au Revoir

I love this world
Yet, I know
Love is never enough,
to keep anything,
forever…

-Donald Raab


Iterating over Lists in Java with indices using external and internal iterators

Photo by Maksym Kaharlytskyi on Unsplash

How to iterate over a List in Java with indices

In Java, there are a few ways to to iterate over a List with indices. I will cover a few of the most common external iteration approaches, and how they can be combined with providing an index. I will explain how to use the RandomAccess interface to safely iterate over the List interface.

Iterate using an Iterator

This is the most basic form of collection iteration that works with any Collection (prior to Java 5), and any Iterable type in Java (since Java 5).

List<Integer> list = Lists.mutable.with(1, 2, 3);
int index =…


A Katalogue of Code Katas recorded in a Code Kata

Photo by Thao Le Hoang on Unsplash

What is a Code Kata?

A hands-on programming exercise which helps hone your skills through practice.

Many of us learn best by doing. We build confidence and expertise through continual practice. We also learn by teaching. A Code Kata may help you build proficiency by implementing algorithms in various languages to solve specific problems. A Code Kata may also help you practice leveraging the APIs provided in a library, like Eclipse Collections or Java Streams. Sharing code katas you develop with a community of developers will help you learn even more.

The first set of…


Using Java and Kotlin with Eclipse Collections to solve the Donut Kata

Photo by Ali Tarhini on Unsplash

The Donut Kata

To celebrate the 10 year anniversary of the Kotlin programming language, I thought I would share the solutions to the Donut Code Kata using both Java 16 and Kotlin 1.5.0 with Eclipse Collections 11.0.0.M2. The purpose of the Donut Kata is to help familiarize developers with lesser-known methods in the Eclipse Collections API. Eclipse Collections is a Java library, so it works well in both Java and Kotlin.

The Donut Kata Domain

The domain of the Donut Kata is a Donut Shop. You make donuts, take orders for donuts, and deliver donuts…


Learning a little Python using the Eclipse Collections Pet Kata

Eclipse Collections Pet Kata on GitHub (left) : Python implementation of Person class from Pet Kata

A time to learn Python

I’ve programmed in more than twenty programming languages over the past four decades. I’ve coded in Java for 20+ years, and am the creator of a Java collections framework called Eclipse Collections. I have never tried to learn Python before. That is, until now.

Why learn Python?

I am a Java Champion, and regularly teach and advocate for the Java programming language. My learning Python might seem a bit odd to some. In fact, some of my friends started pinging me on Twitter after I posted several tweets about me solving the Pet…


Everything I know about software development in a single page of quotes.

Goat Fell, Isle of Arran — Scotland — Photo taken by Donald Raab in 2004

Background

At the end of 2003, I accepted an opportunity to go on an extended business trip with my family to England. We moved to London in January of 2004, and returned back to the states at the end of the same year. Before I left, I decided I wanted to distill everything I knew about software development down to a set of memorable quotes. I used to read a lot of books. Most of the books I read were technical, but some were about leadership and project management…


Out of hundreds of possibilities, these are some of my favorite methods available on the Eclipse Collections API.

My favorite methods in Eclipse Collections

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 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.


A poem about limiting yourself.

Reaching for the sky and staying in the same place with the same group — Armstrong Redwoods State Natural Reserve — Photo taken by Donald Raab

Background

This is a poem I wrote in 1988 that was published in my high school’s art and literary magazine. I hope you enjoy the poem, and my selection of pictures to go with it.

The Clique

Watch out little fly,
Don’t get caught,
You’re in danger, run away quick!
Don’t you understand,
Spider’s web means spider,
Spider means death.
Oh well, if you must follow every other fly’s mistake,
Learn for yourself.
You’re about to join an exclusive group,
And once you’re in the web,
You kill off all other possibilities.
To put it simply,
You’re stuck.

-Donald Raab

Donald Raab

Java Champion. Creator of the Eclipse Collections OSS Java library (http://www.eclipse.org/collections/). Inspired by Smalltalk. Opinions are my own.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store