add method

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

Find the key/set entry, and add the value to the set. If the key doesn't exist, will first create it with an empty set, and then add the value to it. If the value already exists in the set, nothing happens.

Implementation

IMapOfSets<K, V> add(K key, V value) {
  ISet<V> set = _mapOfSets[key] ?? ISetImpl.empty<V>(config.asConfigSet);
  ISet<V> newSet = set.add(value);
  return set.same(newSet) ? this : replaceSet(key, newSet);
}