equalItems method

  1. @override
bool equalItems(
  1. covariant Iterable? other
)
override

Will return true only if the IList items are equal to the iterable items, and in the same order. This may be slow for very large lists, since it compares each item, one by one. You can compare the list with ordered sets, but unordered sets will throw a StateError. To compare the IList with unordered sets, try the unorderedEqualItems method.

Implementation

@override
bool equalItems(covariant Iterable? other) {
  if (other == null) return false;
  if (identical(this, other)) return true;

  if (other is IList) {
    if (_isUnequalByHashCode(other)) return false;
    return (flush._l as LFlat).deepListEquals(other.flush._l as LFlat);
  }

  if (other is List<T>)
    return const ListEquality<dynamic>().equals(UnmodifiableListFromIList<T>(this), other);

  if (other is HashSet) throw StateError("Can't compare to HashSet (which is unordered).");

  return const IterableEquality<dynamic>().equals(_l, other);
}