List list = new ArrayList<T>();
Map map = new HashedMap();
for (int i = 0; i < 10; i++) {
map.put("id", i);
map.put("name", i);
list.add(map);
}
list中存放的是指针。list循环添加了同一个指针。
转载于:https://my.oschina.net/orgsky/blog/229425
List list = new ArrayList<T>();
Map map = new HashedMap();
for (int i = 0; i < 10; i++) {
map.put("id", i);
map.put("name", i);
list.add(map);
}
转载于:https://my.oschina.net/orgsky/blog/229425