if we retrieve value from Map and then we do some changes ,
so we again need to put that object back on Map
for ex
Human human = (Human ) domainObjects
.get(Constants.Human;
human.setName("Vish");
domainObjects.put(Constants.Human, human);
Or as we are passing the reference of object,the changes will be also present in the domain object even without using Map put function
Map returns a copy of a reference to the underlying object. Not a copy of the object. When you call setName you are changing the object.
It would appear you should be using enums for you Constants or plain classes.
or