title: How to create Java List of Type E extends Comparable<? super E>
body: <p>I am trying to implement the Quicksort method written in java on Rosettacode.org.</p>
  
  <p><a href="http://rosettacode.org/wiki/Sorting_algorithms/Quicksort#Java" rel="nofollow">http://rosettacode.org/wiki/Sorting_algorithms/Quicksort#Java</a></p>
  
  <p>However, I do not know how to add elements to a LinkedList of type E in order to use the method.</p>
  
  <pre><code>public static &lt;E extends Comparable&lt;? super E&gt;&gt; void main(String[] args) {
  
          List&lt;E&gt; list = new LinkedList&lt;E&gt;();
  
          list.add(1);
  }
  </code></pre>
  
  <p>I get the following error when I try to compile:</p>
  
  <pre><code>QuickSort.java:12: error: no suitable method found for add(int)         list.add(1);
              ^
      method List.add(int,E) is not applicable
        (actual and formal argument lists differ in length)
      method List.add(E) is not applicable
        (actual argument int cannot be converted to E by method invocation conversion)
      method Collection.add(E) is not applicable
        (actual argument int cannot be converted to E by method invocation conversion)   where E is a type-variable:
      E extends Comparable&lt;? super E&gt; declared in method &lt;E&gt;main(String[]) 1 error make: *** [c] Error 1
  </code></pre>