title: What does 'Collections.sort(intervals, new Comparator<Interval>() { [...]' mean?
body: <p>I came across a method that merges overlapping intervals. It has one part that I don't understand:</p>
  
  <pre><code>Collections.sort(intervals, new Comparator&lt;Interval&gt;() {
      @Override
      public int compare(Interval i1, Interval i2) {
          return Integer.compare(i1.start, i2.start);
      }
  });
  </code></pre>
  
  <p>What exactly is it doing and returning?</p>