How to initialize a Set using Eclipse Collections

Donald Raab
Sep 19, 2022

--

Initializing a Set using Eclipse Collections is simple and flexible.

Using the object and primitive Sets factory with method.

I answered the following question on Stack Overflow several years ago.

If you prefer of instead of with, the following will work just as well.

Using the object and primitive Sets factory of method.

If you’d like to understand why Eclipse Collections supports both of and with methods on factory classes, the following blog will help.

Thanks for reading! Enjoy!

I am the creator of and a Committer for the Eclipse Collections OSS project which is managed at the Eclipse Foundation. Eclipse Collections is open for contributions.

--

--

Donald Raab

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