I have been reading up on HashMap Collisions and I have found two different definitions and am not sure which is the correct one.
Collision resolution in Java HashMap
The top answer in this is "Collision happens when multiple keys hash to the same bucket."
I see another answer in the same question that is "A collision happens when two different keys happen to have the same hash code, or two keys with different hash codes happen to map into the same bucket in the underlying array."
For #1, multiple keys can hash to the same bucket, but have different hashCodes. Different HashCodes can be % or & to the same bucket, but be different numbers.
For #2, it is saying multiple keys have the same hashCode, and therefore hashing to the same bucket.
Which is the correct definition? Or are there different terms for both these occurences?
Edit: I cannot comment on the answers for clarification unfortunately, as I do not have the points for it. Thanks