Skip to content

Instantly share code, notes, and snippets.

@iyengarajay
Last active July 3, 2016 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iyengarajay/988d6abb4d71281ce1ba167e5d4b575b to your computer and use it in GitHub Desktop.
Save iyengarajay/988d6abb4d71281ce1ba167e5d4b575b to your computer and use it in GitHub Desktop.
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