isEqualsIterable<T> function

bool isEqualsIterable<T>(
  1. Iterable<T>? i1,
  2. Iterable<T>? i2
)

Returns true if both iterable, i1 and i2, have equals entries in the same order.

Implementation

bool isEqualsIterable<T>(Iterable<T>? i1, Iterable<T>? i2) {
  if (identical(i1, i2)) return true;
  if (i1 == null) return false;
  if (i2 == null) return false;

  var length = i1.length;
  if (length != i2.length) return false;

  var itr1 = i1.iterator;
  var itr2 = i2.iterator;

  while (itr1.moveNext()) {
    if (!itr2.moveNext()) {
      return false;
    }

    var v1 = itr1.current;
    var v2 = itr2.current;

    if (v1 != v2) return false;
  }

  return true;
}