Skip to content

Instantly share code, notes, and snippets.

@iyengarajay
Last active July 3, 2016 12:38
Embed
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);
System.out.println(strings);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment