Though two different objects may have the same hash code, however, System.identityHashCode() seems return the memory pointer of the object. I guess there could be no exception in 32-bit JVM implementations, includes Sun JDK, Open JDK. I didn’t check the source code, though. In practice, can I assume two objects with the same System.identityHashCode() are the same?
Though two different objects may have the same hash code, however, System.identityHashCode() seems return
Share
The short answer is no.
As per the documentation,
System.identityHashCode(Object)…So then lets check the documentation of
Object.hashCode()…