static bool setAdd_remove(Collection c, Collection d, A a) { if (c.contains(a)) { d.remove(a); false; } c.add(a); d.remove(a); true; }