Answer:
(Assuming Java)
public ArrayList diff(ArrayList list1, ArrayList list2) {
ArrayList<Integer> union = new ArrayList<>();
for (int element : list1) {
union.add(element);
}
for (int element : list2){
if (!union.contains(element)) {
union.add(element);
}
}
return union;
}
Explanation:
Create an ArrayList that has the union of list1 and list2.
First for loop copies all elements into the union array list.
Second for loop adds all elements that are not yet in the union arraylist to the union arraylist.
(Keep in mind that I assume that you mean a mathematical union, so no duplicates. If this is not what you mean, remove the if statement in the second for loop)
I think it is false hope this helps
The biggest differences between inkjet and laser printers is that an inkjet printer uses ink, is suitable for low volume printing, and is the traditional choice of home users, while a laser printer uses toner, is ideal for high volume printing, is mostly utilized in office settings but is also suitable and is a more ...
Answer:
Social media can be biased.