title: Android Calendar.compareTo returns 0 for different times
body: <p>I found a strange behavior of <code>Calendar</code> class in Android. When I need to sort some list of events by time, I construct a <code>Comparator</code> like this:</p>
  
  <pre><code>    @Override
      public int compare(Event lhs, Event rhs) {
          return lhs.getUserTime().compareTo(rhs.getUserTime());
      }
  </code></pre>
  
  <p>where <code>getUserTime</code> is a <code>Calendar</code> instance. The strange thing is that this method always returns 0 even if <code>Dates</code> wrapped in <code>Calendars</code> are explicitly different.</p>
  
  <p>Extracting <code>Dates</code> from <code>Calendars</code> solves the problem:</p>
  
  <pre><code>    @Override
      public int compare(Event lhs, Event rhs) {
          return lhs.getUserTime().getTime().compareTo(rhs.getUserTime().getTime());
      }
  </code></pre>
  
  <p>But I don't understand where the problem comes from in the first place. </p>