Сортировка Arraylist
Collections.sort(testList);
Collections.reverse(testList);
Adventurous Anaconda
Collections.sort(testList);
Collections.reverse(testList);
ArrayList<ArrayList<String>> yourList = ...
Collections.sort(yourList, new Comparator<ArrayList<String>>() {
@Override
public int compare(ArrayList<String> one, ArrayList<String> two) {
return one.get(1).compareTo(two.get(1));
}
});
return Arrays.stream(words.split(" "))
.sorted(Comparator.comparing(s -> Integer.valueOf(s.replaceAll("\\D", ""))))
.reduce((a, b) -> a + " " + b).get();