List<HashMap<String,Object>> resultList = new ArrayList<HashMap<String,Object>>();
HashMap<String,Object> result1 = new HashMap<String,Object>();
result.put("colour","红色");
result.put("empName", "张三");
result.put("depotType", "常驻");
resultList.add(result1);
HashMap<String,Object> result2 = new HashMap<String,Object>();
result.put("colour","红色");
result.put("empName", "张三");
result.put("depotType", "常驻");
resultList.add(result2);
HashMap<String,Object> result3 = new HashMap<String,Object>();
result.put("colour","蓝色");
result.put("empName", "张三");
result.put("depotType", "外包");
resultList.add(result3);
HashMap<String, HashMap> msp = new HashMap<String, HashMap>();
List<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
for(int i = resultList.size()-1; i>=0; i--){
HashMap map = resultList.get(i);
String name = (String)map.get("empName");
map.remove("empName");
msp.put(name, map);
}
Set<String> mspKey = msp.keySet();
for(String key: mspKey){
HashMap newMap = msp.get(key);
newMap.put("empName", key);
result.add(newMap);
}
return result;