List<String> aList=new ArrayList<String>();
List<String> bList=new ArrayList<String>();
aList.add("1111");
aList.add("2222");
aList.add("3333");
bList.add("1111");
bList.add("2222");
bList.add("4444");
Iterator<String> aListIte = aList.iterator();
while (aListIte.hasNext()){
String a=aListIte.next();
System.out.println("a:"+a);
Iterator<String> bListIte = bList.iterator();
while(bListIte.hasNext()){
String b=bListIte.next();
System.out.println("b:"+b);
if(a.equals(b)){
aListIte.remove();
bListIte.remove();
}
}
}
List<String> bList=new ArrayList<String>();
aList.add("1111");
aList.add("2222");
aList.add("3333");
bList.add("1111");
bList.add("2222");
bList.add("4444");
Iterator<String> aListIte = aList.iterator();
while (aListIte.hasNext()){
String a=aListIte.next();
System.out.println("a:"+a);
Iterator<String> bListIte = bList.iterator();
while(bListIte.hasNext()){
String b=bListIte.next();
System.out.println("b:"+b);
if(a.equals(b)){
aListIte.remove();
bListIte.remove();
}
}
}