I have an class that generates a String object as:
key = "K:" + this.hashCode();
This class doesn't inherit from any other and it does not override hashCode(). I have a situation where I am getting duplicate keys, so two different instances of an object return the exact same hashCode().
How can this happen and what can be done to avoid it? This class is part of an API that I'm using, so I don't have control over it, but if there is some way I can put a wait or something whenever I create an instance of this object, then something like that could work.