static void removeSetFromListQuickly(L l, Set set) { if (l(set) < 10) { ListIterator it = l.listIterator(); while (it.hasNext()) if (set.contains(it.next())) it.remove(); } else { L l2 = emptyListWithCapacity(l); for (A a : l) if (!set.contains(a)) l2.add(a); copyList(l2, l); } }