title: Collections.sort() error
body: <p>I am trying to sort a list of type A named BinOrder in class B according to Class A's int r.</p>
  
  <p>However i am receiving this error for the line Collections.sort(BinOrder);</p>
  
  <pre><code>The method sort(List&lt;T&gt;) in the type Collections is not applicable for the arguments (ArrayList&lt;A&gt;)
  </code></pre>
  
  <p>Class A: </p>
  
  <pre><code>public class A{
  int s; 
  int r;
  
  public A(int si, int ri) {
      s=si;
      r= ri;
   }
  }
  </code></pre>
  
  <p>Class B:</p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Collections;
  
  
  public class B implements Comparable&lt;A&gt; {
  
  
  
      public Iterator&lt;A&gt; randomMethodName(int a) {
          ArrayList&lt;A&gt; BinOrder = new ArrayList&lt;A&gt;();
                  A a = new A(1,3)
                  A a2 = new A(1,4)
  
                  BinOrder.add(a);
                  BinOrder.add(a2);
          }
  
          // sort array in increasing order of r
          Collections.sort(BinOrder);
          return BinOrder;
      }
  
      @Override
      public int compareTo(A list) {
  
          return null;
      }
  }
  </code></pre>