int[][] test={{1,2},{3,0},{2,1}};
Arrays.sort(test, (n1 , n2) -> n1[0] - n2[0]);
for(int i=0;i<test.length;i++){
System.out.println(test[i][0]+" "+test[i][1]);
}
输出为:
1 2
2 1
3 0
int[][] test={{1,2},{3,0},{2,1}};
Arrays.sort(test, (n1 , n2) -> n1[0] - n2[0]);
for(int i=0;i<test.length;i++){
System.out.println(test[i][0]+" "+test[i][1]);
}
输出为:
1 2
2 1
3 0