class="java" name="code">public class Test { public static void main(String[] args) { List<Map<String,Object>> list=new ArrayList<Map<String,Object>>(); Map<String,Object> map0 = new HashMap<String, Object>(); Map<String,Object> map1 = new HashMap<String, Object>(); map0.put("hello", "helloo"); map1.put("world", "worldd"); list.add(map0); list.add(map1); List<Map<String,Object>> listTmp=new ArrayList<Map<String,Object>>(); for(Map<String,Object> map:list){ listTmp.add(map); } for(Map<String,Object> mapTmp:listTmp){ mapTmp.put("java","javaa"); break; } /** 打印结果 * hello*****helloo * java*****javaa * world*****worldd */ for(Map<String,Object> map:list){ for(String s: map.keySet()){ System.out.println(s+"*****"+map.get(s)); } } } }
?