title: Are there any standard Java classes with inconsistent compareTo() and equals()?
body: <p>I'm looking for all standard Java classes for which <code>compareTo()</code> can return <code>0</code> while <code>equals()</code> returns <code>false</code>:</p>
  
  <pre><code>Comparable comparable1 = ???;
  Comparable comparable2 = ???;
  
  assert comparable1.compareTo(comparable2) == 0;
  assert !comparable1.equals(comparable2);
  </code></pre>
  
  <p>I know just one: <code>new BigDecimal("1.0")</code> is equal to <code>new BigDecimal("1")</code> using <code>compareTo()</code> but not equal using <code>equals()</code>. Are there any others?</p>
  
  <p>I'm interested in all such classes, but only from public Java API. I need it to provide thorough documentation for AssertJ's <a href="https://github.com/joel-costigliola/assertj-core/blob/master/src/main/java/org/assertj/core/api/UnevenComparableAssert.java" rel="noreferrer"><code>UnevenComparableAssert</code></a> interface.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Thanks to @ErikVesteraas, I've managed to reproduce additional example:</p>
  
  <pre><code>Calendar calendar1 = new GregorianCalendar(0, 0, 0);
  Calendar calendar2 = new GregorianCalendar(0, 0, 0);
  calendar2.setLenient(false);
  
  Comparable comparable1 = calendar1;
  Comparable comparable2 = calendar2;
  
  assert comparable1.compareTo(comparable2) == 0; // compareTo compares along the timeline
  assert !comparable1.equals(comparable2); // equals compares state, leniency is different
  </code></pre>