List of utility methods to do Array Sort
void | sortTwoArrays( A[] firstArray, B[] secondArray) Utility method to sort two related arrays - that is, two arrays where the elements are related to each other by their position in the array. if (firstArray.length != secondArray.length) { throw new RuntimeException( "Both arrays must be of the same length"); class element { public A first; public B second; element[] elements = new element[firstArray.length]; Arrays.sort(elements, new Comparator<element>() { public int compare(element a, element b) { return a.first.compareTo(b.first); }); for (int i = 0; i < elements.length; i++) { firstArray[i] = elements[i].first; secondArray[i] = elements[i].second; |