//直接使用java的Collections对集合进行排序,这里是通过通话的次数call_cnt这个json的key来进行由大到小降序排序List<Map> list= (List<Map>) JSONObject.parseObject(value.get("report_data").toString()).get("contact_list");Collections.sort(list, new Comparator<Map>() { @Override public int compare(Map o1, Map o2) { if(o1 instanceof Map && o2 instanceof Map) { Map e1 = (Map) o1; Map e2 = (Map) o2; //需要升序的话就Integer.parseInt(e1.get("call_cnt").toString())-Integer.parseInt(e2.get("call_cnt").toString()); return Integer.parseInt(e2.get("call_cnt").toString())-Integer.parseInt(e1.get("call_cnt").toString()) ; } throw new ClassCastException("转换成int类型失败"); }});