Hash collision
Also called: Collision
Two different keys that end up in the same bucket of a hash map.
Definition
A hash map has far fewer buckets than possible keys, so different keys sometimes map to the same bucket. The map handles this by chaining entries in the bucket or probing for the next free slot, and uses equals (==) to find the right one. A few collisions are normal; many collisions make lookups slow.
In practice
In Java, "Aa" and "BB" have the same hashCode (2112), so they always land in the same bucket.
Learn it in context
Lessons that use this term.