object reference set in java
Posted
by landon9720
on Stack Overflow
See other posts from Stack Overflow
or by landon9720
Published on 2010-04-29T14:43:11Z
Indexed on
2010/04/29
14:47 UTC
Read the original article
Hit count: 141
java
|collections
I need to create a Set of objects. The concern is I do not want to base the hashing or the equality on the objects' hashCode and equals implementation. Instead, I want the hash code and equality to be based only on each object's reference identity (i.e.: the value of the reference pointer).
I'm not sure how to do this in Java.
The reasoning behind this is my objects do not reliably implement equals or hashCode, and in this case reference identity is good enough.
© Stack Overflow or respective owner