W3cubDocs

/Dart 2

HashMap<K, V>.fromEntries constructor

  1. @Since("2.1")
HashMap<K, V>.fromEntries(Iterable<MapEntry<K, V>> entries)

Creates a HashMap containing the entries of entries.

Returns a new HashMap<K, V> where all entries of entries have been added in iteration order.

If multiple entries have the same key, later occurrences overwrite the earlier ones.

Implementation

@Since("2.1")
factory HashMap.fromEntries(Iterable<MapEntry<K, V>> entries) =>
    HashMap<K, V>()..addEntries(entries);

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-collection/HashMap/HashMap.fromEntries.html