I am a little lost. What's the syntax to declare a sort function in a class ?
I have my class here :
public class PLClass
{
double PL;
int index;
/** other functions **/
}
And I want to sort a collection of elements PLClass with order based on the element double PL:
public ArrayList<PLClass> Mycollec;
Collections.sort(Mycollec, Collections.reverseOrder(PL));
I get the following error message : Description: The method reverseOrder(Comparator) in the type Collections is not applicable for the arguments (double).
Any idea what I am missing ? Thanks !
If your main intention is to only sort a collection of PLClass based on the element PL then the following might be what you are looking for