Skip to content

Instantly share code, notes, and snippets.

@feng-ming
Created August 4, 2020 12:19
Show Gist options
  • Save feng-ming/b27144f3b6a29cc88f28a78b37b87742 to your computer and use it in GitHub Desktop.
Save feng-ming/b27144f3b6a29cc88f28a78b37b87742 to your computer and use it in GitHub Desktop.
sdf #java
public static List<String> entriesSortedByValues(List<String> lists) {
Collections.sort(lists,
new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
return o2.split("\\|")[0].compareTo(o1.split("\\|")[0]);
}
}
);
return lists;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment