When is the unmodifiablemap (really) necessary?
Collections.unmodifiableMap guarantees that the map will not be modified. It’s mostly useful if you want to return a read-only view of an internal map from a method call, e.g: class A { private Map importantData; public Map getImportantData() { return Collections.unmodifiableMap(importantData); } } This gives you a fast method that does not risk the client … Read more