Originally posted by Alok Pota:
I would like to take two sets A & B and remove from the set B
all elements common to A & B. Is there a clean way to do this using java.util.Collections?
Assuming that A abd B both implement the Set interface (HashSet, TreeSet), you can just do:
B.removeAll(A);
If it ends up removing any objects, the method will return true. Also, the List interface has a removeAll method, so I think you're covered for any standard
Java class implementing Collection. I don't think you need the Collections class.