flatten method

Iterable<MapEntry<K, V>> flatten()

Return a flattened iterable of <K, V> entries (including eventual duplicates), where each entry is a key:value pair. For example, if the map is {1: {a, b}, 2: {x, y}}, it will return (1:a), (1:b), (2:x), (2:y).

Implementation

Iterable<MapEntry<K, V>> flatten() sync* {
  for (MapEntry<K, ISet<V>> entry in _mapOfSets.entries) {
    for (V value in entry.value) {
      yield MapEntry<K, V>(entry.key, value);
    }
  }
}