Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Unified Diff: sdk/lib/collection/linked_hash_map.dart

Issue 18072004: Add fromIterable(s) constructors in SplayTreeMap and LinkedHashMap. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/collection/linked_hash_map.dart
diff --git a/sdk/lib/collection/linked_hash_map.dart b/sdk/lib/collection/linked_hash_map.dart
index 3082ce0881a8b99736968e9a37839bb375c80bbb..7425c18c917c912e26ec4c5c7b3c6ad9376c347a 100644
--- a/sdk/lib/collection/linked_hash_map.dart
+++ b/sdk/lib/collection/linked_hash_map.dart
@@ -25,6 +25,19 @@ class LinkedHashMap<K, V> implements Map<K, V> {
return new LinkedHashMap<K, V>()..addAll(other);
}
+ factory LinkedHashMap.fromIterable(Iterable iterable,
+ {K key(element), V value(element)}) {
+ LinkedHashMap<K, V> map = new LinkedHashMap<K, V>();
+ Maps._fillMapWithMappedIterable(map, iterable, key: key, value: value);
+ return map;
+ }
+
+ factory LinkedHashMap.fromIterables(Iterable<K> keys, Iterable<V> values) {
+ LinkedHashMap<K, V> map = new LinkedHashMap<K, V>();
+ Maps._fillMapWithIterables(map, keys, values);
+ return map;
+ }
+
external bool containsKey(Object key);
external bool containsValue(Object value);

Powered by Google App Engine
This is Rietveld 408576698