title: What are the alternatives to comparing the equality of two objects?
body: <p><a href="http://leepoint.net/notes-java/data/expressions/22compareobjects.html" rel="nofollow noreferrer">http://leepoint.net/notes-java/data/expressions/22compareobjects.html</a></p>
  
  <blockquote>
    <p>It turns out that defining equals()
    isn't trivial; in fact it's moderately
    hard to get it right, especially in
    the case of subclasses. The best
    treatment of the issues is in
    Horstmann's Core Java Vol 1.</p>
  </blockquote>
  
  <p>If equals() must always be overridden, then what is a good approach for not being cornered into having to do object comparison? What are some good "design" alternatives?</p>
  
  <p>EDIT:</p>
  
  <p>I'm not sure this is coming across the way that I had intended. Maybe the question should be more along the lines of "Why would you want to compare two objects?" Based upon your answer to that question, is there an alternative solution to comparison? I don't mean, a different implementation of equals. I mean, not using equality at all. I think the key point is to start with that question, why would you want to compare two objects.</p>