title: How to write a method signature "T that implements Comparable<T>" in Java?
body: <p>What signature should I have on my <code>insert</code>-method? I'm struggling with the generics. In a way, I want both <code>Comparable&lt;T&gt;</code> and <code>T</code> and I have tried with <code>&lt;Comparable&lt;T&gt; extends T&gt;</code>.</p>
  
  <pre><code>public class Node&lt;T&gt; {
  
      private Comparable&lt;T&gt; value;
  
      public Node(Comparable&lt;T&gt; val) {
          this.value = val;
      }
  
      // WRONG signature - compareTo need an argument of type T
      public void insert(Comparable&lt;T&gt; val) {
          if(value.compareTo(val) &gt; 0) {
              new Node&lt;T&gt;(val);
          }
      }
  
      public static void main(String[] args) {
          Integer i4 = new Integer(4);
          Integer i7 = new Integer(7);
  
          Node&lt;Integer&gt; n4 = new Node&lt;&gt;(i4);
          n4.insert(i7);
      }
  }
  </code></pre>