withConfig method
Creates a new map with the given config
.
To copy the config from another IMap:
map = map.withConfig(other.config)
To change the current config:
map = map.withConfig(map.config.copyWith(isDeepEquals: isDeepEquals))
See also: withIdentityEquals and withDeepEquals.
Implementation
@useCopy
IMap<K, V> withConfig(ConfigMap config) {
if (config == this.config)
return this;
else {
// If the new config is not sorted it can use sorted or not sorted.
// If the new config is sorted it can only use sorted.
if (!config.sort || this.config.sort)
return IMap._unsafe(_m, config: config);
//
// If the new config is sorted and the previous is not, it must sort.
else
return IMap._unsafe(MFlat.from(_m, config: config), config: config);
}
}