title: Why Map doesn't work with a Date as a key?
body: <p>I just observed when I create a <code>TreeMap</code> based on a <code>Date</code> as a key, and sorted by date, functions like <code>remove(Date key)</code> or <code>containsKey(Date key)</code> don't work even if the date is well present in the Map. Furthermore, the equals function of Date works well.</p>
  
  <p>So, does anyone know why it doesn't work?</p>
  
  <p>I'm using the old Java 6u43 and I create my Map like that:</p>
  
  <pre><code>    Map&lt;Date, Integer&gt; hourMap = new TreeMap&lt;Date, Integer&gt;(new Comparator&lt;Date&gt;() {
          @Override
          public int compare(Date d1, Date d2) {
              return d1.after(d2) ? 1 : -1;
          }
      });
      Date now = DateUtils.parseDate("04:00:00", "HH:mm:ss");
      hourMap.put(now, 12);
      hourMap.remove(now); // doesn't work
      boolean test = hourMap.containsKey(now); // return false
  </code></pre>