exceptE method

Enumerable<T> exceptE (Iterable<T> other, { EqualityComparer<T> comparer })

Returns the set difference between the enumerable and the given collection.

After applying the exceptE method to an enumerable, the resulting enumerable will consist of all the elements in the source enumerable that are not present in the given other collection. This is equivalent to taking the set difference of the two sequences.

Optionally, an EqualityComparer can be supplied to handle comparisons. If one is provided, the exceptE method will use the comparer and hasher properties in order to determine equivalency. If omitted, exceptE will resort to strict equivalency (i.e. checking if (value == element)).

(For the exceptE method, only the comparer and hasher properties of the EqualityComparer need be supplied.)

If none of the elements in the source enumerable match any element in the given other collection, the enumerable will be unchanged.

Implementation

Enumerable<T> exceptE(Iterable<T> other, {EqualityComparer<T> comparer}) {
  ArgumentError.checkNotNull(other);
  return ExceptEnumerable<T>(this, other, comparer);
}