//定义一个List<Map<String, Object>> List<Map<String, Object>> maxFlows = Lists.newArrayList(); //给集合赋值 maxFlows = dataUtil(); //根据集合中的 “q” 值正序排序 Collections.sort(maxFlows, new Comparator<Map<String, Object>>() { public int compare(Map<String, Object> o1, Map<String, Object> o2) { String strQ2 = o2.get("q").toString(); String strQ1 = o1.get("q").toString(); return (Integer.valueOf(strQ2)).compareTo(Integer.valueOf(strQ1)); } }); return maxFlows;
List<Map<String, Object>>集合排序
最新推荐文章于 2023-03-11 18:05:21 发布