Originally posted by Broke
Another way is to add all element of list1 to list2 if they are not already there. You would use the contains method this way
Code:
for(int i = 0;i < list1.size();i++) {
if(!list2.contains(list1.get(i))) {
list2.add(list1.get(i));
}
else {
//already there so do nothing
}
}
Comment