Sortieren einer Liste von Listen nach dem Wert der Unterliste
private List<String> subList;
private List<List<String>> records = new ArrayList<List<String>>();
for(....){
subList = new ArrayList<String>();
...populate..
records.add(subList);
}
Zum Beispiel hat subList drei Strings - a, b und c. Ich möchte die Datensätze nach dem Wert von b in der Unterliste sortieren.
records at 0 has a list of "10", "20", "30"
records at 1 has a list of "10", "05", "30"
records at 2 has a list of "10", "35", "30"
Nach der Sortierung sollte die Reihenfolge der Datensätze wie folgt lauten:
records at 0 = records at 1 above
records at 1 = records at 0 above
records at 2 = records at 2 above
Was könnte ein guter Algorithmus dafür sein?