operator == method

  1. @override
bool operator ==(
  1. Object other
)
override
  • If isDeepEquals configuration is true: Will return true only if the map entries are equal (not necessarily in the same order), and the map configurations are equal. This may be slow for very large maps, since it compares each entry, one by one.

  • If isDeepEquals configuration is false: Will return true only if the maps internals are the same instances (comparing by identity). This will be fast even for very large maps, since it doesn't compare each entry.

Note: This is not the same as identical(map1, map2) since it doesn't compare the maps 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 IMap) && isDeepEquals
    ? equalItemsAndConfig(other)
    : (other is IMap<K, V>) && same(other);