On 2/13/19 7:22 PM, Alan Snyder wrote:
If we take this route, how about changing the parameter type to Iterable?
Won't work. Where I've ended up is that we need to iterate over "this" collection and, for each element, call contains() on the parameter. The AbstractCollection.removeAll() implementation does something like this:
removeAll(Collection<?> c) { for (Iterator<?> it = iterator(); it.hasNext();) { if (c.contains(it.next())) { it.remove(); } } } Since we call contains() on the parameter, it has to be a Collection. s'marks