static void removeAllBut(Set a, Collection b) { if (a != null) for (Iterator it = a.iterator(); it.hasNext(); ) if (!contains(b, it.next())) it.remove(); } static void removeAllBut(Map a, Collection b) { if (a != null) removeAllBut(a.keySet(), b); }