I am trying to sort a list of type A named BinOrder in class B according to Class A\'s int r.
However i am receiving this error for the line Collections.sort(BinOrder);<
To be able to use the single-argument version of Collection.sort() on an ArrayList
of A
, A
should implement the Comparable
interface:
public class A implements Comparable {
...
@Override
int compareTo(A rhs) {
...
}
}