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<String> delData(List<String> sourceList, List<String> targetList){
Iterator<String> 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<String> sourceList = new ArrayList<>();
sourceList.add("1");
sourceList.add("2");
sourceList.add("3");
sourceList.add("4");
sourceList.add("5");
List<String> 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]
}
}