HashMap<K, V>.from constructor

HashMap<K, V>.from(Map other)

Creates a HashMap that contains all key/value pairs of other.

The keys must all be instances of K and the values of V. The other map itself can have any type.

Implementation

factory HashMap.from(Map other) {
  Map<K, V> result = new HashMap<K, V>();
  other.forEach((k, v) {
    result[k] = v;
  });
  return result;
}