- List<Hashtable<String,Object>> list = new ArrayList<Hashtable<String,Object>>();
- Hashtable<String,Object> hb1 = new Hashtable<String,Object>();
- hb1.put("4", "浙江");
- hb1.put("3", "广西");
- hb1.put("2", "江苏");
- hb1.put("1", "江西 ");
- list.add(hb1);
- hb1 = new Hashtable<String,Object>();
- hb1.put("4", "浙江");
- hb1.put("3", "广西");
- hb1.put("2", "江苏");
- hb1.put("1", "江西 ");
- list.add(hb1);
- hb1 = new Hashtable<String,Object>();
- hb1.put("4", "江西");
- hb1.put("3", "广西");
- hb1.put("2", "云南");
- hb1.put("1", "江苏");
- list.add(hb1);
- hb1 = new Hashtable<String,Object>();
- hb1.put("4", "云南");
- hb1.put("3", "广西");
- hb1.put("2", "江苏");
- hb1.put("1", "江西 ");
- list.add(hb1);
- System.out.println(list);
- Map<String,Hashtable<String,Object>> groups = new HashMap<String,Hashtable<String,Object>>();
- for(Hashtable<String,Object> hb:list){
- //汇总
- if(groups.containsKey(""+hb.get("4")+hb.get("3"))){
- /* int group =Integer.parseInt(groups.get(""+hb.get("4")+hb.get("3")).get("1")+"");
- hb.put("1",Integer.parseInt(hb.get("1")+"")+group);
- groups.put(""+hb.get("4")+hb.get("3"), hb);*/
- }
- groups.put(""+hb.get("4")+hb.get("3"), hb);
- }