I have been implementing a hashmap from scratch and this dawned on me.
Lets say I have 3 distinct keys and 3 values
Keys -> Value: A -> 1, B -> 2,C -> 3
and they each land in an open slot in the array.
If the fourth key D produces the same hash index as one of the previously 3 keys I can use any of the collision strategies to handle this case (Linear Probing, rehashing, etc )
However lets say I want to overwrite [Key A, Value 1] with [Key A, 99]. This is a collision however Java.Util.HashMap knows you want to overwrite the value.
If a collision occurs, How do you determine whetherto overwrite a value or search for an open location ?