package com.hep.core.erp.data;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
public class Test {
public List delData(List sourceList, List targetList){
Iterator it = sourceList.iterator();
while (it.hasNext()){
String str = it.next();
if(targetList.contains(str)){
it.remove();
}
}
return sourceList;
}
public static void main(String[] args) {
List sourceList = new ArrayList<>();
sourceList.add("1");
sourceList.add("2");
sourceList.add("3");
sourceList.add("4");
sourceList.add("5");
List targetList = new ArrayList<>();
targetList.add("1");
targetList.add("2");
sourceList = new Test().delData(sourceList, targetList);
System.out.println(Arrays.toString(sourceList.toArray()));//[3, 4, 5]
}
}