I have a list of pair
private List<Pair<String, List<School>> words = new ArrayList<Pair<String, List<School>>();
Here I have to sort it by no of student in a school.
I have a list of pair
private List<Pair<String, List<School>> words = new ArrayList<Pair<String, List<School>>();
Here I have to sort it by no of student in a school.
Use words.sort(comparator)
where comparator
is instance of your Comparator<Pair<String, List>>
or lambda.
More information about list sorting: How to sort an ArrayList?