title: Using Comparable<T> with Generic class
body: <p>A newbie question (possibly duplicate too) but can someone point me what's wrong with the below code:</p>
  
  <pre><code>public class Node&lt;T&gt; implements Comparable&lt;Node&lt;T&gt;&gt; {
  
      protected final Comparable&lt;T&gt; data;
      protected final List&lt;Node&lt;T&gt;&gt; adj;
  
      public Node(Comparable&lt;T&gt; data) {
          this.data = data;
          adj = new ArrayList&lt;Node&lt;T&gt;&gt;();
      }
  
      @Override
      public int compareTo(Node&lt;T&gt; other) {
          return data.compareTo(other.data);
      }
  }
  </code></pre>
  
  <p>The compareTo method shows a compilation error: 
  compareTo(T) in Comparable cannot be applied to (java.lang.Comparable).</p>
  
  <p>Alternatively I tried using <code>public class Node&lt;T extends Comparable&lt;? super T&gt;&gt; implements Comparable&lt;Node&lt;T&gt;&gt;</code> but then if I add this <code>Node</code> in, say, an ArrayList> then I am not able to use the <code>contains</code> method of ArrayList.
  I'd be very thankful if someone points me out the difference.</p>