I have a "Couple" class with nothing more special than a String and a double:
public class Couple{
public String mot;
public double indice;
public Couple(){
this.mot = "";
this.indice = 0;
}
public Couple(String t, double q){
this.mot = t;
this.indice = q;
}
}
Now, suppose I have an array of Couple. I want to sort that array by the double from each value. For example:
Before sorting :
{("hi",3), ("hello",1),("Good",2),("nice",0)}
After sorting according to the double values of each couple:
{("nice",0),("hello",1),("Good",2),("hi",3)}