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