title: How come generic type parameter says "extends" Comparable not "implements"?
body: <p>I tried to write generic function that remove the duplicate elements from array.</p>
  
  <pre><code>public static &lt;E extends Comparable&lt;E&gt;&gt; ArrayList&lt;E&gt; removeDuplicate(E[] arr) {
      //do quicksort
      Arrays.sort(arr);
      ArrayList&lt;E&gt; list = new ArrayList&lt;E&gt;();
      int i;
      for(i=0; i&lt;arr.length-1; i++) {
          if(arr[i].compareTo(arr[i+1]) != 0) { //if not duplicate, add to the list
              list.add(arr[i]);
          }
      }
      list.add(arr[i]); //add last element
      return list;
  }
  </code></pre>
  
  <p>As you can see you can't pass primitive type like int[] array since I am comparing elements by compareTo() method that defined in Comparable interface.</p>
  
  <p>I noticed the first line (method declaration):</p>
  
  <pre><code>public static &lt;E extends Comparable&lt;E&gt;&gt; ArrayList&lt;E&gt; removeDuplicate(E[] arr) {
  </code></pre>
  
  <p>How come it says "extends Comparable" ?</p>
  
  <p>Comparable is an interface so why is it not "implement Comparable"? This is first time I wrote generic function so I'm bit confused about such detail. (any wondering would prevent me from understanding..)</p>
  
  <p>EDIT: Found this article related to this topic.</p>
  
  <p><a href="http://www.tutorialspoint.com/java/java_generics.htm" rel="noreferrer">http://www.tutorialspoint.com/java/java_generics.htm</a></p>