When we put key-value pair in HashMap this could happen the hashcode of two keys could be same then how in this condition storing and retrieval of key-value will be handled.
Update
What I understand so far is that if two object key has same hash code then both key objects will be stored in same bucket and when I will say get(key) then out of two objects with matching hashcode which element to fetch is decided by object.equals().
When you want to retrieve some object from hashmap and there exists several objects with the same hashcode, java will call
equals()to determine the right object.That is why it is so important to override
equals()when overridinghashCode().