Skip to content

Instantly share code, notes, and snippets.

@forketyfork
Created May 13, 2021 07:21
Show Gist options
  • Save forketyfork/7d1757ddcdc053fb72bbf180f7df2451 to your computer and use it in GitHub Desktop.
Save forketyfork/7d1757ddcdc053fb72bbf180f7df2451 to your computer and use it in GitHub Desktop.
Code to article "Custom String Comparison in Java"
var strings = List.of("aaa", "bbb", "ddd", "ccc", "aba");
var sortedStrings = strings.stream().sorted().toList();
System.out.println(sortedStrings);
// => [aaa, aba, bbb, ccc, ddd]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment