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

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

Issue 838463002: Change List/Set/Map/Queue.from constructrs to accept any iterable. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 0d6c019684f60df9372adf373f572d934fd413c8..e1bca0f509645ba2441fb12b13028ee64768bc1c 100644
--- a/sdk/lib/collection/linked_hash_map.dart
+++ b/sdk/lib/collection/linked_hash_map.dart
@@ -69,8 +69,10 @@ abstract class LinkedHashMap<K, V> implements HashMap<K, V> {
/**
* 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);
+ factory LinkedHashMap.from(Map other) {
+ LinkedHashMap<K, V> result = new LinkedHashMap<K, V>();
+ other.forEach((k, v) { result[k] = v; });
+ return result;
}
/**

Powered by Google App Engine
This is Rietveld 408576698