Skip to content

Instantly share code, notes, and snippets.

Last active July 3, 2016 12:38
What would you like to do?
List<String> strings = Arrays.asList("Joey", "Ben","Sandra","Glen");
Comparator<String> sortByLength = (s1,s2)-> s1.length() < s2.length() ? 1 : -1;
Collections.sort(strings, sortByLength);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment