1 /** 2 * 将集合按照降序排列-FLOAT 3 * @param nowPartTwoData 4 * @return 5 */ 6 private static List> sortByValueFloatDesc(Map nowPartTwoData){ 7 //这里将map.entrySet()转换成list 8 List > list = new ArrayList >(nowPartTwoData.entrySet()); 9 //然后通过比较器来实现排序10 Collections.sort(list,new Comparator >() {11 //降序排序12 @Override13 public int compare(Map.Entry o1,14 Map.Entry o2) {15 return o2.getValue().compareTo(o1.getValue());16 }17 });18 19 return list;20 }