list添加map问题
结论: list添加添加的是map的地址 List<Map<String, Object>> list = new ArrayList<>(); Map<String, Object> map = new HashMap<>(); for (int a = 0; a < 2; a++) { map.put("a", a); map.put("b", a); list.add(map); } System.out.println(list); 结果: [{b=1, a=1}, {b=1, a=1}] <<<<<<<<<<<=======分割线=====>>>>>>>>>>>>>>>>>>>> List<Map<String, Object>> list = new ArrayList<>(); for (int a = 0; a < 2; a++) { Map<String, Object> map = new HashMap<>(); map.put("a", a); map.put("b", a); list.add(map); } System.out.println(list); 结果: [{b=0, a=0}, {b=1, a=1}]