Let us consider HashMap
, which employs separate chaining to resolve hashcode collisions.
If I have multiple entries, where hascode comes out to be same, the collision mechanism forms a linked-list chain of all those entries.
Now, lets consider a case, where such linked list is present as:
(K1,V1,->) (K2,V2, ->) (K7,V7,->) (K9,V9,)
Now a new entry is coming in, for which the hashcode is coming as same, and the key has same value as K7. Will it overwrite the existing value of K7?