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);<
Here's the signature of Collections.sort :
public static > void sort(List list)
A
must implement Comparable for this method.
You try to pass BinOrder
to this method, when BinOrder
is of type ArrayList
, but since A
does not implement Comparable
, it doesn't fit the signature of the method.
Either change A
to implement Comparable, or use the sort
method that accepts a Comparator :
public static void sort(List list, Comparator super T> c)