replaceSet method

IMapOfSets<K, V> replaceSet(
  1. K key,
  2. ISet<V> set
)
  • When removeEmptySets is true: If the given set is not empty, add the key/set entry. If the key already exists, replace it with the new set entirely. If the given set is empty, the key/set entry will be removed (same as calling removeSet).

  • When removeEmptySets is false: Add the key/set entry. If the key already exists, replace it with the new set entirely.

Implementation

IMapOfSets<K, V> replaceSet(K key, ISet<V> set) {
  return (config.removeEmptySets && set.isEmpty)
      ? removeSet(key)
      : IMapOfSets<K, V>._unsafe(_mapOfSets.add(key, set), config);
}