I have a HashMap[CustomEnumeration, String] as a member of my class.
But if i give a getter to it, external objects will be able to modify it (adding new couples of entry/value or removing some of them). And I don't want that.
So I gave a look at the methods entrySet() of Map, but they say that modifications from one of both objects (the returned set and the original map) are backed on the other side.
So what is the best way of dealing with this ? Is there a way to get an immutable set/map from my map ?
P.S I have looked at How to get a immutable collection from java HashMap?, but I am sure I don't need such complexity, as I only use a "nearly primitve type" and I primitive type. So, what is the best solution in my case ?