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