java sort 2d array

Solutions on MaxInterview for java sort 2d array by the best coders in the world

showing results for - "java sort 2d array"
Evan
09 Sep 2016
1Arrays.sort(myArr, (a, b) -> a[0] - b[0]);
2
Haven
02 Apr 2018
1Arrays.sort(myArr,(double[] a,double[] b)->{
2                //here multiple lines of code can be placed
3                return a[0]-b[0]; 
4            });
Ciara
28 Sep 2017
1Arrays.sort(contests, (a, b) -> Integer.compare(b[0],a[0])); //decreasing order
2    
3Arrays.sort(contests, (a, b) -> Integer.compare(a[0],b[0]); //increasing order
4
Federica
23 Jun 2019
1Arrays.sort(myArr, (a, b) -> a[0] - b[0]);