Eclipse Collections already has
MutableMap.withMap method which allows merging a
MutableMap with any JDK Map and returns a
MutableMap. I contributed a similar method
ImmutableMap API. I also added
ImmutableMap.newWithMapIterable method so that a user can merge any
MapIterable type which includes
ImmutableMap as well. The new methods return a new
ImmutableMap because it is created only once and it does not have a put method to allow any modifications. To maintain symmetry with the
MutableMap, I added
MutableMap.putAllMapIterable methods. The link to my Pull Request is here.
How to create new Map Instances?
The new APIs methods will be available in the next release of EC (11.0.0).
Learning from contribution to OSS
- After I added the two new methods to the
MutableMapIterableinterface and two methods to
ImmutableMapIterableinterface, I started getting a lot of compilation errors, so I started tracing down the path to fix those compilations down the hierarchy. I thought it was very cool.
- I made these four implementations using four commits in a Pull request. In order to manage and keep the history aligned, I created a lot of local branches. I had amazing learning experience using Git rebase, cherry-picking, squash and many more.
- I worked with passionate developers in this project and always found someone helping me out when I felt stuck. To me, it was very important because I was new to contribute to OSS.
- I also found some of the blogs below to be very useful. Do check them out!
More resources on Eclipse Collections
Visualizing Eclipse Collections
A visual overview of the APIs, Interfaces, Factories, Static Utility and Adapters in Eclipse Collections using mind…
MapIterable.getOrDefault() : New but not so new API
Eclipse Collections comes with it’s own List, Set, and Map implementations. These implementations extend the JDK List…
Happy Coding and Happy Learning!