public class SortListExample {
public static void main(String[] args) {
List a = Arrays.asList("TEAMA", "COUNTRYA", "PLAYERA");
List b = Arrays.asList("TEAMB", "COUNTRYF", "PLAYERB");
List c = Arrays.asList("TEAMC", "COUNTRYR", "PLAYERC");
List d = Arrays.asList("TEAMB", "COUNTRYA", "PLAYERD");
List e = Arrays.asList("TEAMA", "COUNTRYA", "PLAYERE");
List f = Arrays.asList("TEAMA", "COUNTRYF", "PLAYERF");
List> FinalList = new ArrayList<>();
FinalList.add(a);
FinalList.add(b);
FinalList.add(c);
FinalList.add(d);
FinalList.add(e);
FinalList.add(f);
List> listToSort = new ArrayList<>(FinalList);
listToSort.sort((l1, l2) -> {
int i = 0;
while (true) {
if (l1.get(i) != null && l2.get(i) != null) {
int compareVal = l1.get(i).compareTo(l2.get(i));
if (compareVal != 0) {
return compareVal;
}
i++;
}
}
});
for (List list: listToSort) {
System.out.println(list);
}
}
}