title: no suitable method found for sort(List<User>)
body: <p>This thing just won't compile. I don't know what I'm doing wrong.The compiler is barking at <em>Collections.sort(users);</em>. See the error message down below right after the program listing. It would be much appreciated if you could provide any kind of insight as to what is really wrong with that piece of code.</p>
  
  <p>Here's the output from the command <em>java -version</em>:</p>
  
  <pre><code>java version "1.8.0_25"
  Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
  Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
  </code></pre>
  
  <p>.</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.List;
  import java.util.Collections;
  
  class MyApp {
      public static void main(String[] args) {
  
          List&lt;User&gt; users = new ArrayList&lt;&gt;();
  
          users.add(new User("John Doe"));
          users.add(new User("Bob Smith"));
          users.add(new User("Jane Doe"));
          users.add(new User("Bill Gates"));
  
          Collections.sort(users);
  
          for (User user : users)
              System.out.println(user.name);
     }
  }
  
  class User implements Comparable&lt;User&gt; {
      public String name;
      User(String name) { this.name = name; }
      @Override public int compareTo(User user) {
          return this.name.compareTo(user.name);
      }
  }
  </code></pre>
  
  <p>Here's the ugly error message that I'm getting:</p>
  
  <pre><code>MyApp.java:15: error: no suitable method found for sort(List&lt;User&gt;)
              Collections.sort(users);
                     ^
      method Collections.&lt;T#1&gt;sort(List&lt;T#1&gt;) is not applicable
        (inference variable T#1 has incompatible bounds
          equality constraints: User
          upper bounds: Comparable&lt;? super T#1&gt;)
      method Collections.&lt;T#2&gt;sort(List&lt;T#2&gt;,Comparator&lt;? super T#2&gt;) is     not appli
  cable
        (cannot infer type-variable(s) T#2
          (actual and formal argument lists differ in length))
    where T#1,T#2 are type-variables:
      T#1 extends Comparable&lt;? super T#1&gt; declared in method     &lt;T#1&gt;sort(List&lt;T#1&gt;)
  T#2 extends Object declared in method &lt;T#2&gt;sort(List&lt;T#2&gt;,Comparator&lt;?     super
   T#2&gt;)
  1 error
  </code></pre>