equals method
Compare two elements for being equal.
This should be a proper equality relation.
Implementation
@override
bool equals(Iterable<E>? elements1, Iterable<E>? elements2) {
if (identical(elements1, elements2)) {
return true;
}
if (elements1 == null || elements2 == null) {
return false;
}
final Iterator<E> it1 = elements1.iterator;
final Iterator<E> it2 = elements2.iterator;
while (true) {
final bool hasNext = it1.moveNext();
if (hasNext != it2.moveNext()) {
return false;
}
if (!hasNext) {
return true;
}
if (!_elementEquality.equals(it1.current, it2.current)) {
return false;
}
}
}