Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Sort comparator in java

int[][] twoDim = { { 1, 2 }, { 3, 7 }, { 8, 9 }, { 4, 2 }, { 5, 3 } };

Arrays.sort(twoDim, (int[] o1, int[] o2) -> o2[0] - o1[0]);

System.out.println(Arrays.deepToString(twoDim));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Sort #comparator #java
ADD COMMENT
Topic
Name
6+6 =