title: Sort a list of generic interface
body: <p>Here is the case, I have two classes <code>A</code>, <code>B</code>, and a generic interface <code>C</code></p>
  
  <pre><code>Class A implements Comparable&lt;A&gt; {...}
  
  interface C&lt;T&gt; {...}
  
  //this class is not longer generic type, I do not know if this matter.
  Class B extends A implements C&lt;A&gt; {...} 
  </code></pre>
  
  <p>Then, at other class, I got a <code>B</code> List and sort it as follow</p>
  
  <pre><code>List&lt;B&gt; list = new ArrayList&lt;B&gt;();
  Collections.sort(list);
  </code></pre>
  
  <p>This works perfectly, but now I would like to change the list of <code>B</code> to the generic interface <code>C</code>, so that it can be more general.</p>
  
  <pre><code>List&lt;C&lt;A&gt;&gt; list = new ArrayList&lt;C&lt;A&gt;&gt;();
  Collections.sort(list);
  </code></pre>
  
  <p>This time I got the Error as follow:</p>
  
  <blockquote>
    <p>Bound mismatch: The generic method <code>sort(List&lt;T&gt;)</code> of type <code>Collections</code> is not
    applicable for the arguments <code>(List&lt;C&lt;A&gt;&gt;)</code>. The inferred type <code>C&lt;A&gt;</code> is not a
    valid substitute for the bounded parameter <code>&lt;T extends Comparable&lt;? super T&gt;&gt;</code></p>
  </blockquote>
  
  <p>I have tried the following modifications (of course does not work):</p>
  
  <ol>
  <li>change <code>C</code> to <code>interface C&lt;T&gt; extends Comparable&lt;T&gt;{...}</code></li>
  <li>change <code>B</code> to <code>class B extends A implements C&lt;A&gt;, Comparable&lt;T&gt; {...}</code></li>
  </ol>
  
  <p>Can anybody help me?</p>