/**
* 将集合按照降序排列-Double
* @param nowPartTwoData
* @return
*/
private static List<Map<String,Double>> sortByValueFloatDesc(Map<String, Double> nowPartTwoData) {
List<Map.Entry<String, Double>> lists = new ArrayList<Map.Entry<String, Double>>(nowPartTwoData.entrySet());
Collections.sort(lists, new Comparator<Map.Entry<String, Double>>() {
public int compare(Map.Entry<String, Double> o1, Map.Entry<String, Double> o2) {
Double q1 = Double.parseDouble(o1.getValue()+"");
Double q2 = Double.parseDouble(o2.getValue()+"");
Double p = q2 - q1;
if (p > 0) {
return 1;
} else if (p == 0) {
return 0;
} else
return -1;
}
});
for (Map.Entry<String, Double> set : lists) {
System.out.println(set.getKey() + " " + set.getValue());
}
return null;
}