Say I have two ArrayLists:
name: [Four, Three, One, Two] num: [4, 3, 1, 2]
If I do: Arrays.sort(num), then I have:
name: [
Instead of sorting the actual arrays you can have an array with just indices
a[i] = i for i = 0..n
and you can sort this array based on your numeruc array with a custom comparator. e.g.
bool compare( int a, int b ) { return num[a] < num[b]; }
Thus you have both arrays sorted by using these indices.