remove method

IMapOfSets<K, V> remove(
  1. K key,
  2. V value
)

Find the key/set entry, and remove the value from the set. If the key doesn't exist, don't do anything. If the set becomes empty and removeEmptySets is true, the key will be removed entirely. Otherwise, the key will be kept and the set will be empty (not null).

Implementation

IMapOfSets<K, V> remove(K key, V value) {
  ISet<V>? set = _mapOfSets[key];
  if (set == null) return this;
  ISet<V> newSet = set.remove(value);

  return set.same(newSet)
      ? this
      : (config.removeEmptySets && newSet.isEmpty)
          ? removeSet(key)
          : replaceSet(key, newSet);
}