I have two lists that might look like this:
A: {1 3 1 2}
B: {1 3}
I would like to remove the elements of list B from list A and end up with:
A: {1 2}
But if I use A.removeAll(B) I will end up with only the value 2 since all the duplicate instances of value 1 will be removed from list A. My solution up until now was to use an Iterator over all elements of A and then all elements of B and if I find a similar value then remove it from both lists until list B is empty.
Is there a better way of doing it?
B: {3 1}?