您的位置:首页 > 其它

list里面数据被覆盖

2016-03-24 16:17 417 查看
不可能被覆盖,除非你有调用clear()方法,或是你的集合定义在一个方法里,然后你的程序走出了这个方法,再回来的时候,前面的数据肯定是没有的。希望可以帮到你。

if(!ModelUtil.checkListIsBlank(originalList)){

Map<Long,List<Record>> originalMap = ModelUtil.getSortMapList(originalList,"id",Long.class);

for (Long key : originalMap.keySet()) {

temp = new Record();

List<Record> recordList = originalMap.get(key);

temp = ModelUtil.getResultData(recordList.get(0), "project_id","project_name","pic_md5","pic_name","message_id","user_id","create_time","create_user_id","last_update_time","last_update_user_id","curr_type");

temp.set("id",key);

Map<Long,List<Record>> ImageMap = ModelUtil.getSortMapList(recordList,"imgId",Long.class);

resultList2 = new ArrayList<Record>();

for (Long key2 : ImageMap.keySet()){

temp2 = new Record();

List<Record> ImageList = ImageMap.get(key2);

temp2 = ModelUtil.getResultData(ImageList.get(0), "img_pic_md5","img_pic_name","page_index","dyn_impress_id","img_uuid");

temp2.set("imgId",key2);

Map<Long,List<Record>> buttonMap = ModelUtil.getSortMapList(ImageList,"button_id",Long.class);

resultList3 = new ArrayList<Record>();

for (Long key3 : buttonMap.keySet()){

temp3 = new Record();

List<Record> buttonList = buttonMap.get(key3);

temp3 = ModelUtil.getResultData(buttonList.get(0), "sub_dyn_impress_image_id","zone_x","zone_y","zone_z","zone_width","zone_height","button_uuid");

temp3.set("button_id",key3);

resultList3.add(temp3);

}

temp2.set("buttonList",resultList3);

resultList2.add(temp2);

}

temp.set("iamgeList",resultList2);

resultList.add(temp);

}

}

要新建对象
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: