1.单个对象属性去重:
public List<Object> removeDuplicate(List<Object> list) {
List<Object> listTemp = new ArrayList<Object>();
for(int i=0;i<list.size();i++){
if(!listTemp.contains(list.get(i))){
listTemp.add(list.get(i));
}
}
return listTemp;
}
2.多个对象属性去重
public List<Object> removeDuplicate(List<Object> woDetails) {
List<Object> wolist = new ArrayList<Object>();
for(Object wo : woDetails){
boolean state = false;
for(woDetails w : wolist){
if(w.getWO_NO().equals(wo.getWO_NO())&&w.getIN_DATE().equals(wo.getIN_DATE())){
state = true;
}
}
if(!state){
wolist.add(wo);
}
}
}