public static void compare(List<String> maplist) {
Collections.sort(maplist, new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
// TODO Auto-generated method stub
int s1 = Integer.parseInt(o1.split(":")[1]);
int s2 = Integer.parseInt(o2.split(":")[1]);
return s1 < s2 ? 1 : (s1 == s2) ? 0 : -1;
}
});
}
List集合针对元素中包含的字符串排序
最新推荐文章于 2024-05-12 23:28:18 发布