equals method
inherited
Compare two elements for being equal.
This should be a proper equality relation.
Implementation
@override
bool equals(T? elements1, T? elements2) {
if (identical(elements1, elements2)) return true;
if (elements1 == null || elements2 == null) return false;
var counts = HashMap<E, int>(
equals: _elementEquality.equals,
hashCode: _elementEquality.hash,
isValidKey: _elementEquality.isValidKey);
var length = 0;
for (var e in elements1) {
var count = counts[e] ?? 0;
counts[e] = count + 1;
length++;
}
for (var e in elements2) {
var count = counts[e];
if (count == null || count == 0) return false;
counts[e] = count - 1;
length--;
}
return length == 0;
}