I have a 2D array to sort as a whole using Java.
I have looked at the various links
How to sort a two-dimension ArrayList using comparators.
But it always sorts on a specific element. I want to able to sort for the whole 2d array.
For eg,
int[][] r = {{1,7,5},{1,3,5},{1,3,6}, {2,3,1}};
on sorting should give me
{1,2,3},{1,3,5},{1,3,6},{1,5,7}.
Thanks!
This will suit your needs: