Skip to content

Instantly share code, notes, and snippets.

@timmyBeef
Created February 6, 2021 05:06
Show Gist options
  • Save timmyBeef/7c989068b86ee0eb9480a0798eb7596c to your computer and use it in GitHub Desktop.
Save timmyBeef/7c989068b86ee0eb9480a0798eb7596c to your computer and use it in GitHub Desktop.
List<String> words = List.of("tim", "beef", "lin");
Collections.sort(words, new Comparator<>() {
@Override
public int compare(String s1, String s2) {
return Integer.compare(s1.length(), s2.length()) ;
}
}) ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment