Java HashMap uses put method to insert the K/V pair in HashMap.
Lets say I have used put method and now HashMap<
When multiple keys end up in same hash code which is present in same bucket. When the same key has different values then the old value will be replaced with new value.
Liked list converted to balanced Binary tree from java 8 version on wards in worst case scenario.
Collision happen when 2 distinct keys generate the same hashcode() value. When there are more collisions then there it will leads to worst performance of hashmap.
Objects which are are equal according to the equals method must return the same hashCode value. When both objects return the same has code then they will be moved into the same bucket.