I have a strange issue occuring in my application, I will quickly explain global architecture and then my problem in depth.
I use a service to populate a HashM
Is your DomainObject
class immutable? Does it have properly implemented hashCode
and equals
methods?
Note that you will get into trouble if your DomainObject
class is not immutable and you change the state of the object while it is in the map in a way that would change the result of calling hashCode
or equals
.
hashCode
must be implemented in such a way that it returns the same value for two objects whenever equals
returns true when comparing these objects. See the API documentation of java.lang.Object.hashCode()
for detailed information.