operator == method
-
If isDeepEquals configuration is
true
: Will returntrue
only if the set items are equal (and in the same order), and the set configurations are equal. This may be slow for very large sets, since it compares each item, one by one. -
If isDeepEquals configuration is
false
: Will returntrue
only if the sets internals are the same instances (comparing by identity). This will be fast even for very large sets, since it doesn't compare each item.
Note: This is not the same as identical(set1, set2)
since it doesn't
compare the sets themselves, but their internal state. Comparing the
internal state is better, because it will return true more often.
Implementation
@override
bool operator ==(Object other) => (other is ISet) && isDeepEquals
? equalItemsAndConfig(other)
: (other is ISet<T>) && same(other);