Created
February 6, 2021 05:06
-
-
Save timmyBeef/7c989068b86ee0eb9480a0798eb7596c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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