public int compare (Object o1, Object o2)
the original order is the order parameter o1, O2;
if the sequence returns -1 holding exchange sequence returns 1, do nothing returns 0;
therefore, in ascending order, then, If o1 <o2, returns -1.
Example: two-dimensional array num achieved by the first column in ascending order, the first column of the second row by the same descending order.
Arrays.sort (Yan, (O1, O2) -> {
! IF (O1 [0] = O2 [0]) {
return O1 [0] - O2 [0]; // first column in ascending order
} the else {
return o2 [1] - o1 [1 ]; // second column in descending order
}
});