java List 排序

List<Map.Entry<String, String>> infoIds =
new ArrayList<Map.Entry<String, String>>(ratioMap.entrySet());
Collections.sort(infoIds, new Comparator<Map.Entry<String, String>>() {
public int compare(Map.Entry<String, String> o1, Map.Entry<String, String> o2) {
//return (o2.getValue() - o1.getValue());
return (o1.getKey()).toString().compareTo(o2.getKey());
}
});
for (int i = 0; i < infoIds.size(); i++) {
String id = infoIds.get(i).toString();
System.out.println(id);
}

上一篇:【BZOJ1040】[ZJOI2008]骑士 树形DP


下一篇:Mysql通过一个限制条件,查出多条不同的记录