title: Collections.sort implementation
body: <p>I can not understand the method implementation and the logic of Collections.sort method. Here is the method implementation i found,</p>
  
  <pre><code>public static &lt;T extends Comparable&lt;? super T&gt;&gt; void sort(List&lt;T&gt; list) {
      Object[] a = list.toArray();
      Arrays.sort(a);
      ListIterator&lt;T&gt; i = list.listIterator();
      for (int j=0; j&lt;a.length; j++) {
          i.next();
          i.set((T)a[j]);
      }
      }
  </code></pre>
  
  <p>First of all this method return type is void. What is <code>&lt;T extends Comparable&lt;? super T&gt;&gt;</code> does in the method signature?</p>
  
  <p>What is the purpose of using Array.sort here?</p>
  
  <p>Also once we implement comparable or comparator where is the compare or compareTo method logic that we wrote take in to consider?</p>