Update:
As it turns out, I was (mostly) being a horse’s ass. It was a bit difficult to find, but Java does provide a mechanism for getting the equivalent of Object.hashCode() on any given object (not in a general way, i.e. get the un-overridden behavior, but for this case specifically). That method is System.identityHashCode(). Java also provides a hash data structure that uses == instead of .equals(), IdentityHashMap. I’ll leave the rest of the article around, though, just so I can use it as a reminder of how silly I look with my foot in my mouth.
One of the side-effects of the way Java is designed is that it is hard to identify an object. By this, I don’t mean identifying it by its apparent value, as in a List is the same as another list with the same stuff in the same order. What I mean is identifying an object as this object, not by its value, but by its physical existence in the whole program world thingamabobber. This usually isn’t too big of a problem, until you really start working with the collection framework’s HashMap.
(more…)