Collection targetList = new ArrayList();
for (Iterator iter = sourceList.iterator();iter.hasNext();){
SourceVO sourceVO = (SourceVO)iter.next();
//通过另外的方法构造一个Collection即otherList(Collection中放的是另外的VOs)
....
sourceVO.setItems(otherList);
targetList.add(sourceVO );
} 运行后发现Collection:targetList 中的Collection:otherList的值是一样的?怎么解决这个问题?
谢谢!
for (Iterator iter = sourceList.iterator();iter.hasNext();){
SourceVO sourceVO = (SourceVO)iter.next();
//通过另外的方法构造一个Collection即otherList(Collection中放的是另外的VOs)
....
sourceVO.setItems(otherList);
targetList.add(sourceVO );
} 运行后发现Collection:targetList 中的Collection:otherList的值是一样的?怎么解决这个问题?
谢谢!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货