It is better to either make a defensive copy of the map in constructor, or pass an unmodifiable view of it.