Last active
April 26, 2018 12:15
-
-
Save keinix/911cdc48755ec700dfe87d4b260dbf32 to your computer and use it in GitHub Desktop.
Sort an object based on a String field
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
public void sortSubReddits(List<SubReddit> subreddits) { | |
Collections.sort(subreddits, (sub1, sub2) -> | |
String.CASE_INSENSITIVE_ORDER.compare(sub1.getDisplayName(), sub2.getDisplayName())); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment