vavr icon indicating copy to clipboard operation
vavr copied to clipboard

Add `removeAll` to `Traversable`

Open l0rinc opened this issue 9 years ago • 1 comments

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.

l0rinc avatar Apr 28 '16 14:04 l0rinc

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...

danieldietrich avatar Apr 28 '16 22:04 danieldietrich