-6

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.

SouvikBiswas
  • 53
  • 1
  • 7

1 Answers1

1

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?