addValues method

  1. @useCopy
IMapOfSets<K, V> addValues(
  1. K key,
  2. Iterable<V> values
)

Find the key/set entry, and add all the values to the set. If the key doesn't exist, will first create it with an empty set, and then add the values to it.

Implementation

@useCopy
IMapOfSets<K, V> addValues(K key, Iterable<V> values) {
  ISet<V> set = _mapOfSets[key] ?? ISetImpl.empty<V>(config.asConfigSet);
  ISet<V> newSet = set.addAll(values);
  return set.same(newSet) ? this : replaceSet(key, newSet);
}