difference method

Iterable<T> difference(
  1. Eq<T> eq,
  2. Iterable<T> other
)

Return an Iterable containing the values of this Iterable not included in other based on eq.

Implementation

Iterable<T> difference(Eq<T> eq, Iterable<T> other) sync* {
  for (var element in this) {
    if (!other.any((e) => eq.eqv(e, element))) {
      yield element;
    }
  }
}