addEntries method

IMapOfSets<K, V> addEntries(
  1. Iterable<MapEntry<K, Set<V>>> entries
)

Adds all set values to this map.

For each key that is already in this map, its resulting set will contain the values of the original map, plus the ones of the other entries.

For example: if map = {"a": {1, 2}}, then map.addAll({"a": {3}, "b": {4}}) will result in {"a": {1, 2, 3}, "b": {4}}

The operation is equivalent to doing addValues for each key:set in entries.

Implementation

IMapOfSets<K, V> addEntries(Iterable<MapEntry<K, Set<V>>> entries) {
  IMapOfSets<K, V> imap = this;
  for (MapEntry<K, Set<V>> entry in entries) {
    var key = entry.key;
    var setOfValues = entry.value;
    imap = imap.addValues(key, setOfValues);
  }
  return imap;
}