What is a hash collision in Java?
A hash collision occurs when two objects have different data but the same hash code, leading to an incorrect retrieval from the `HashMap`.
You're on the right track! A hash collision does occur when two objects have the same hash code, but it doesnâ€™t necessarily lead to incorrect retrieval. The collision is handled internally in the collection.
Can you explain how `HashMap` resolves hash collisions and how the `equals()` method comes into play?