HashMap - how will it store objects where hashcode is same? How will it retrieve them?
Antworten zu Vorstellungsgespräch
Anonym
18. Juli 2011
Basically if there is a hashcode collision then HashMap would rely on equals method for further equality checks.
Anonym
20. Aug. 2011
In case of key hashcode collision, the bucket will be same but considering each bucket location of hashmap as a linked list, the key-value pair will be stored on the next node in the same bucket. At the time of retreival, it will use keys.equal to get the correct node.