UKG interview question

How HashMap works ?

Interview Answer

Anonymous

Jun 29, 2015

Working of HashMap.. First of all we have to find out the hashCode of that object(Value), then this hashCode is divided by 16, because default array size is 16, then the remainder of that division will be the index of array where this value have to be placed. When the remainder of two values are same, then Linked List has generated at that array index. This is how HashMap works.