com.google.common.collect.arbitrary()
claims to produce a reliable comparison of arbitrary objects via System.identityHashCode(Object)
. However, since the hashCode is a 32-bit quantity, I don't see how this could work in a 64-bit address space, where there may be more than 2**32 object instances. Is my skepticism justified?
The source code reveals that in case of a collision between two identity hash codes of different objects, the comparator falls back to a map associating each of the objects with a counter that is incremented each time a new object is stored in the map.