HashMap - how will it store objects where hashcode is same? How will it retrieve them?
Risposte di colloquio
Anonimo
18 lug 2011
Basically if there is a hashcode collision then HashMap would rely on equals method for further equality checks.
Anonimo
20 ago 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.