title: How to implement Comparable so it is consistent with identity-equality
body: <p>I have a class for which equality (as per <code>equals()</code>) <em>must</em> be defined by the object identity, i.e. <code>this == other</code>.</p>
  
  <p>I want to implement <code>Comparable</code> to order such objects (say by some <code>getName()</code> property). To be consistent with <code>equals()</code>, <code>compareTo()</code> must not return <code>0</code>, even if two objects have the same name.</p>
  
  <p>Is there a way to compare object identities in the sense of <code>compareTo</code>? I could compare <code>System.identityHashCode(o)</code>, but that would still return <code>0</code> in case of hash collisions.</p>