例如:
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", "ZK");
map.put("age", 13);
Map<String, Object> map2 = new HashMap<String, Object>();
map2.put("name", "ZA");
map2.put("age", 15);
Map<String, Object> map3 = new HashMap<String, Object>();
map3.put("name", "CX");
map3.put("age", 20);
Map<String, Object> map4 = new HashMap<String, Object>();
map4.put("name", "CX");
map4.put("age", 18);
List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
list.add(map);
list.add(map2);
list.add(map3);
list.add(map4);
在这样的List中如何先按name 字母顺序正序,然后按age 数字倒序,生成一个新的List?
相关分类