title: treemap uses compareTo instead of equals for containsKey()
body: <p>I try to use the <code>containsKey</code> method of a <code>TreeMap</code>, but somehow I have problems with it. </p>
  
  <p>The objects stored in the treemap are defined such as <code>equals()</code> does not deliver the same result as <code>compareTo()</code>. this is intended.</p>
  
  <p>However, the doc of <code>java.util.Map</code> says:</p>
  
  <blockquote>
    <p>Returns true if this map contains a mapping for the specified key. More formally, returns true if and only if this map contains a mapping for a key k such that <code>(key==null ? k==null : key.equals(k))</code>. (There can be at most one such mapping.)</p>
  </blockquote>
  
  <p>So I tried following:</p>
  
  <pre><code>c = someModifiedObject();
  boolean t1 = sm.containsKey(c);
  someObject c2 = new someObject();
  boolean t2 = sm.containsKey(c2);
  boolean t3 = c.equals(new Chain());
  int t4 = c.compareTo(new Chain());
  </code></pre>
  
  <p>t1 is true, as the object is in the treemap.
  t3 is true, as t1 is equal t3 (regarding to the change <code>equals()</code> operator)
  t4 is false
  however, t2 is false as well. It seems that <code>TreeMap</code> uses <code>compareTo()</code> rather than <code>equals()</code> to determine if the object is present.</p>
  
  <p>Is there another implementation of a sorted map, where i can use <code>equals()</code> to check if an object exists?</p>