vavr
vavr copied to clipboard
Add `removeAll` to `Traversable`
removeAll and retainAll seem to have the same usages, I think they should come in pairs: where there is one, the other should be also.
Traversable should:
/**
* Removes all occurrences of the given elements.
*
* @param elements Elements to be removed from this Seq.
* @return a Traversable containing all elements of this but none of the given elements.
* @throws NullPointerException if {@code elements} is null
*/
Traversable<T> removeAll(Iterable<? extends T> elements);
and Iterator impement it via a default method:
@Override
default Iterator<T> removeAll(Iterable<? extends T> elements) {
return Collections.removeAll(this, elements);
}
Some incompatibilities should be resolved in Map also.
I think the reason was the API incompatibility between Set/Seq and Map. Scala also does not have remove* in Traversable. But Scala also has not retainAll as part of Traversable.
Another option is to remove retainAll from Traversable...