HashMap produces a hashCode using the key user submits. Following can be two cases:
1) If two keys (Object) are same:
for instance
hashmap.put(1,"one");
hashmap.put(1,"another one");
Now , initially "one" will be inserted and then it will be overridden by "another one".
2) If the hashCode for two different objects are same: for instance , if I have a bucket of size 5 and I try to:
hashmap.put(5,"this is five");
hashmap.put(25,"this is twenty five");
since hash % (SIZE-1) will point to the same location , LinkedList will be created to store the values as:
"this is twenty five" -> "this is five"
Please correct me if I am wrong