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..4ace5890c4429bdac5c96bb092ced35f32709e9e 100644 |
--- a/sdk/lib/collection/linked_hash_map.dart |
+++ b/sdk/lib/collection/linked_hash_map.dart |
@@ -21,10 +21,50 @@ part of dart.collection; |
class LinkedHashMap<K, V> implements Map<K, V> { |
external LinkedHashMap(); |
+ /** |
+ * Creates a [LinkedHashMap] that contains all key value pairs of [other]. |
+ */ |
factory LinkedHashMap.from(Map<K, V> other) { |
return new LinkedHashMap<K, V>()..addAll(other); |
} |
+ /** |
+ * Creates a [LinkedHashMap] where the keys and values are computed from the |
+ * [iterable]. |
+ * |
+ * For each element of the [iterable] this constructor computes a key/value |
+ * pair, by applying [key] and [value] respectively. |
+ * |
+ * The keys of the key/value pairs do not need to be unique. The last |
+ * occurrence of a key will simply overwrite any previous value. |
+ * |
+ * If no values are specified for [key] and [value] the default is the |
+ * identity function. |
+ */ |
+ factory LinkedHashMap.fromIterable(Iterable<K> iterable, |
+ {K key(element), V value(element)}) { |
+ LinkedHashMap<K, V> map = new LinkedHashMap<K, V>(); |
+ Maps._fillMapWithMappedIterable(map, iterable, key, value); |
+ return map; |
+ } |
+ |
+ /** |
+ * Creates a [LinkedHashMap] associating the given [keys] to [values]. |
+ * |
+ * This constructor iterates over [keys] and [values] and maps each element of |
+ * [keys] to the corresponding element of [values]. |
+ * |
+ * If [keys] contains the same object multiple times, the last occurrence |
+ * overwrites the previous value. |
+ * |
+ * It is an error if the two [Iterable]s don't have the same length. |
+ */ |
+ 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); |