isEquivalentIterator function

bool isEquivalentIterator(
  1. Iterable? it1,
  2. Iterable? it2, {
  3. bool deep = false,
})

Same as isEquivalentList but for Iterable.

Implementation

bool isEquivalentIterator(Iterable? it1, Iterable? it2, {bool deep = false}) {
  if (it1 == it2) return true;

  if (it1 == null) return false;
  if (it2 == null) return false;

  var length = it1.length;
  if (length != it2.length) return false;

  for (var i = 0; i < length; i++) {
    var v1 = it1.elementAt(i);
    var v2 = it2.elementAt(i);

    if (!isEquals(v1, v2, deep)) return false;
  }

  return true;
}