How to sort two dimensional array lexicographically?
问题 Assuming we have a two-dimensional array as follows: int[][] source = { { 3, 5, 6, 1}, { 3, 3, 5, -6}, { -1, -3, -5, -6}, { 124, 43, 55, -66} }; how do we sort the multidimensional array source lexicographically ? So, as a result, I'd expect it to be: [ [ -1, -3, -5, -6], [ 3, 3, 5, -6], [ 3, 5, 6, 1], [124, 43, 55, -66] ] a lot of questions on this site seem to only suggest sorting by the first element of each array or second, third etc. but not taking in consideration the entire array. 回答1: