intersectE method

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

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

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

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

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

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

Implementation

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