eqBy<U> method

  1. @override
bool eqBy<U>(
  1. Iterator<U> other,
  2. bool f(
    1. T,
    2. U
    )
)

Determines if the elements of this Iterator are equal to those of another with respect to the specified equality function.

Implementation

@override
bool eqBy<U>(Iterator<U> other, bool Function(T, U) f) {
  while (true) {
    if (iterator.moveNext()) {
      if (other.moveNext()) {
        if (!f(iterator.current, other.current)) {
          return false;
        }
      } else {
        return false;
      }
    } else {
      if (other.moveNext()) {
        return false;
      }
      return true;
    }
  }
}