I have a multi-dimensional String array with 3 cols, x rows. The value in the 3rd col is a number. I want to sort the records (rows) according to this value. Arrays.sort won't accomodate. Any nudge in the right direction will be GREATLY appreciated.
Well, remember that a multi-dimensional array acts like (is?) an array of arrays. In a, a is an array. Consider iterating through the rows, sorting them. [ December 22, 2004: Message edited by: Nick George ]
I've heard it takes forever to grow a woman from the ground
Your easiest bet to save having to write your own three-column sort routine would be to create a class to hold the three values. Have it either implement Comparable using the number column (or write a separate Comparator). This way you can use Arrays.sort()
posted 13 years ago
Thanks much for the replies. I ended up creating a small class that implements comparable, and was able to achieve the result I was after.
Thanks again, -Brasskey
I love a good mentalist. And so does this tiny ad: