replaceSet method
-
When
removeEmptySets
istrue
: If the givenset
is not empty, add thekey
/set
entry. If thekey
already exists, replace it with the newset
entirely. If the givenset
is empty, thekey
/set
entry will be removed (same as calling removeSet). -
When
removeEmptySets
isfalse
: Add thekey
/set
entry. If thekey
already exists, replace it with the newset
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);
}