/** * Sort the array by multiple indices. * * @param list List: the list to sort * @param indices int[]: the indices to sort by * @return List: the sorted list */ public static List sortByIndices(List list, int[] indices) { Collections.sort(list, new ArrayComparator(indices)); return list; }
/** * Sort the array by index. * * @param list List: the list to sort * @param index int: the index to sort by * @return List: the sorted list */ public static List sortByIndex(List list, int index) { Collections.sort(list, new ArrayComparator(index)); return list; }