How to initialize a static Map using Eclipse Collections
Initializing a Map using Eclipse Collections is simple and flexible.
I answered the following question on Stack Overflow almost a decade ago.
How can I initialise a static Map?
I like the Guava way of initialising a static, immutable map: static final Map MY_MAP = ImmutableMap.of( 1, "one", 2…
If you create a
MutableMap in Eclipse Collections using
withKeyValue, you can then chain as many key / value combinations as you need. As a final conversion step, you can make the Map synchronized (
asSynchronized), unmodifiable (
asUnmodifiable) or immutable (
I show more examples of creating Maps, Lists, Sets, and Bags fluently using Eclipse Collections in the following blog.
As a matter of Factory — Part 3 (Method Chaining)
Learn how to add or remove elements from Java collections fluently by leveraging a few lesser known APIs in Eclipse…
Thanks for reading! Enjoy!
The 2022 Java Developer RoadMap [UPDATED]
Hello guys, first of all, I wish you a very Happy New Year 2022. I have been sharing a lot of roadmaps to become a Web…
10 Best Places to Learn Java Online for Free in 2022
My favorite websites to learn Java online for free, suitable for beginners and people who want to learn to code in Java…