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);
}
}
要新建对象
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);
}
}
要新建对象
相关文章推荐
- [LeetCode][数论]Ugly Number
- CxImage的编译及简单使用举例
- 高效的找出两个List中的不同元素
- IOS 开发 证书显示 此证书签发者无效
- 三大运营商去年一共赚了1391亿元 中移动无线上网收入达到2009亿元
- SqlServer2008安装时提示重启计算机失败 解决办法
- php时间日期处理
- Java编程之数组转换列表的陷阱
- 线性函数
- 垃圾收集算法
- F - Count the Colors
- ubuntu下使用OBS开斗鱼直播
- cssHack
- 学习、阅读笔记——jsonP&Ajax
- java中的强、软、弱和虚引用
- String与InputStream的互相转换
- SecureCRT远程登录ubuntu
- Python datetime的简单使用
- 204. Count Primes
- 高性能网关设备及服务实践