List oldList=new ArrayList();//有数据的对象
List newList=new ArrayList();//合并后的新对象
for (int j = 0; j < oldList.size(); j++)
{
Object o = oldList.get(j);
boolean isExist = false;
for (Object obj : newList)
{
Object detail = obj;
if (obj==o)//去除重复的条件
{
//进行一些合并操作,比如累计数量,金额
o.setXXX("");
isExist = true;
break;
}
}
if (!isExist)
{
newList.add(o);
}
}