It's probably a rather basic question but I can't seem to find an answer that I require online.
However, what's the best way to sort a 2 dimensional array?
I have a pre-populated 2 dimensional array 'mainArr[][]' that contains data:
John Doe - 678DGHJ,Sport
Lisa Parker - 432KH3,Car
John Doe - 678DGHJ, Drive
Peter Bear 4HJ4K3,Bus
John Doe - 4HJK4,Loose
The comma being the separator between the dimension in the array. How can I sort it first by the column first in the array, then by the value in the second part of the array.
The sorted data above would become:
John Doe - 4HJK4,Loose
John Doe - 678DGHJ,Drive
John Doe - 678DGHJ,Sport
Lisa Parker - 432KH3,Car
Peter Bear 4HJ4K3,Bus
So the sorted data in the array of
mainArr[0][0]
would equal
mainArr[John Doe - 4HJK4][Loose]
Collections.sort()with very little additional programming on your part?