记个备忘,下次直接过来拷。
private List<Map<String, String>> orderMapList(List<Map<String, String>> list) { // 将initList 按照count大小排序 for (int i = 0; i < list.size(); i++) { for (int j = i; j < list.size(); j++) { Map<String, String> mapTemp_i = (Map<String, String>) list.get(i); Map<String, String> mapTemp_j = (Map<String, String>) list.get(j); int orderNum_i = Integer.parseInt(mapTemp_i.get("order_number")); int orderNum_j = Integer.parseInt(mapTemp_j.get("order_number")); if (orderNum_i > orderNum_j) { Map<String, String> map_temp = new HashMap<String, String>(); map_temp.putAll(mapTemp_j); mapTemp_j.putAll(mapTemp_i); mapTemp_i.putAll(map_temp); } } } return list; }