Currently, I have 3 arrays of information and I'm not sure how to sort them based on one of the values:
int[] rank = { 1, 3, 4, 2, 5 }; String[] game = { "Snake", "Mines", "Fragged", "Siege", "Tower" }; int[] year = { 1980, 1983, 1981, 1995, 1992 };
I want to sort it by rank, and I saw many examples of using comparators to sort 2 parallel arrays, but I did not see any example for sorting more than 2.
My first thought was to create a class with a variable for each, and then sort this object, but is this an additional class that is really needed for sorting?
source share