无法按降序排序类型为float的键对树形图进行排序

时间:2014-03-13 11:26:43

标签: java sorting treemap

// should return map sorted in descending order according to key 
public Map<Float, String> getSomething() {
    Map<Float,String> x =new TreeMap(Collections.reverseOrder());
    x.put(Float.valueOf("5.0"),"string1");
    x.put(Float.valueOf("9.0"),"string2");
    x.put(Float.valueOf("1.0"),"string3");
    return x;
}

0 个答案:

没有答案