Peter Lawrey: Unique hashCodes is not enough to avoid collisions.
There is a common misconception that if you have unique hashCode() you won't have collisions. While unique, or almost unique, hashCodes are good, this is not the end of the story. The problem is that the size of a HashMap is not unlimited (or at least 2^32 in size). This means the hashCode() number has to be reduced to a smaller number of bits. The way HashMap, and thus HashSet and LinkedHashMap, work is to mutate the bits in the following manner...