Skip to content

Instantly share code, notes, and snippets.

@tmd45
Created November 8, 2011 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmd45/1347057 to your computer and use it in GitHub Desktop.
Save tmd45/1347057 to your computer and use it in GitHub Desktop.
Collections.sort
/*
* hogeList<Map<String, String>> を値の昇順にソートする
*/
Collections.sort(hogeList, new Comparator<Map<String, String>>() {
public int compare(
Map<String, String> hoge1,
Map<String, String> hoge2
) {
String val1 = hoge1.get("key");
String val2 = hoge2.get("key");
return val1.compareTo(val2); // 昇順
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment