Index: sdk/lib/collection/hash_map.dart |
diff --git a/sdk/lib/collection/hash_map.dart b/sdk/lib/collection/hash_map.dart |
index 720403104240f9b1f2aacb0b37dc6ae204ab3b4d..e67fa77556fc9a1d531dd39824e2ea8506922692 100644 |
--- a/sdk/lib/collection/hash_map.dart |
+++ b/sdk/lib/collection/hash_map.dart |
@@ -80,10 +80,12 @@ abstract class HashMap<K, V> implements Map<K, V> { |
external factory HashMap.identity(); |
/** |
- * Creates a [HashMap] that contains all key value pairs of [other]. |
+ * Creates a [HashMap] that contains all key/value pairs of [other]. |
*/ |
- factory HashMap.from(Map<K, V> other) { |
- return new HashMap<K, V>()..addAll(other); |
+ factory HashMap.from(Map other) { |
+ HashMap<K, V> result = new HashMap<K, V>(); |
+ other.forEach((k, v) { result[k] = v; }); |
Søren Gjesse
2015/01/05 15:35:15
Add types K and V?
Lasse Reichstein Nielsen
2015/01/06 10:14:45
The forEach method has type (K',V')->void where ot
Søren Gjesse
2015/01/06 12:09:05
Of cause.
|
+ return result; |
} |
/** |