zoukankan      html  css  js  c++  java
  • list<map<string,object>> 按照某字段排序

           List<Map<String,Object>> groupList1 = Lists.newArrayList();
                // groupList1 这是你自己用来接受查询出来的数据的集合。
                // return  (Long)o1.get("score")>(Long)o2.get("score")?1:( (Long)o1.get("score")==(Long)o2.get("score")?0:-1);//这是从小到大
                // return  (Long)o1.get("score")<(Long)o2.get("score")?1:( (Long)o1.get("score")==(Long)o2.get("score")?0:-1);//这是从大到小
                groupList1.sort((o1, o2) -> {
                    double groupScore1 = Double.parseDouble(o1.get("score").toString());
                    double groupScore2 = Double.parseDouble(o2.get("score").toString());
                    return Double.compare(groupScore2, groupScore1);
                });
  • 相关阅读:
    POJ 3009
    POJ 3253
    POJ 3617
    POJ 3984
    UVA10012
    HDU5100
    HDU 5101
    UVA301 运输
    UVA 331 交换的方案数
    uva 10344 算23点
  • 原文地址:https://www.cnblogs.com/czq520/p/13159379.html
Copyright © 2011-2022 走看看