MultiMap<K, V>.from constructor

MultiMap<K, V>.from(
  1. Iterable<Pair<K, V>> elements, [
  2. int compare(
    1. K,
    2. K
    )?
])

Creates a MultiMap containing the key-value pairs of the given iterable.

Implementation

MultiMap.from(Iterable<Pair<K, V>> elements, [int Function(K, K)? compare])
    : _container = collection.SplayTreeMap<K, List<V>>(compare) {
  for (var element in elements) {
    insert(element.first, element.second);
  }
}