Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Collections.sort(teens,
Comparator.comparing(Teenager::getAge)
.thenComparing(Teenager::getPhoneBrand,Comparator.nullsLast(Comparator.naturalOrder())));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment