Best-effort attempt to hash distinct (but equal/identical) objects to different Long values.
Best-effort attempt to hash distinct (but equal/identical) objects to different Long values.
System.identityHashCode is controlled by the JVM (and likely based on internal IDs used for GC, or memory layout). o.hashCode is controlled by o's class. o.getClass.hashCode distinguishes objects that happen to collide but have different classes.
Two instances of the same class that happen to collide by their class' hash code should still have only a 1-in-4 billion chance of colliding. All other collisions should be even less probable.