I guess this is kind of a common question, but I looked at some other responses and couldn't get my code to work.
I have a 2d array of doubles, two columns and a bunch of rows, and I want to sort the array by the first column in ascending order.
My array is called ratio[][], and I tried this code:
Arrays.sort(ratio, new Comparator<double[]>() {
@Override
public double compare(double[] o1, double[] o2) {
return valueOf(o1[0]).compareTo(valueOf(o2[0]));
}
});
The compiler is finding a bunch of errors. I've imported java.util.Arrays and java.util.Comparator. What am I doing wrong?