Because you called a1.removeAll(a2)
perhaps?
http://docs.oracle.com/javase/7/docs/api/java/util/List.html#removeAll%28java.util.Collection%29
Removes from this list all of its elements that are contained in the specified collection (optional operation).
So, in other words, every element that’s in a2
and also in a1
will be removed from a1
.
2
solved Why an object is removed after using removeAll method