Index: sdk/lib/_internal/pub/lib/src/utils.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/utils.dart b/sdk/lib/_internal/pub/lib/src/utils.dart |
index 14d81a67a4138ea4e2c6aac75429c1a6cc05a132..c51202c637e2c6f6b07040351c6b5767cc7e1aeb 100644 |
--- a/sdk/lib/_internal/pub/lib/src/utils.dart |
+++ b/sdk/lib/_internal/pub/lib/src/utils.dart |
@@ -371,6 +371,20 @@ Future<Map> mapFromIterableAsync(Iterable iter, {key(element), |
})).then((_) => map); |
} |
+/// Returns a new map with all values in both [map1] and [map2]. |
Bob Nystrom
2015/04/24 21:33:09
"values" -> "entries".
nweiz
2015/04/24 21:38:06
Done.
|
+/// |
+/// If there are conflicting keys, [map2]'s value wins. |
Bob Nystrom
2015/04/24 21:33:10
"conflicting" -> "overlapping".
nweiz
2015/04/24 21:38:06
Done.
|
+Map mergeMaps(Map map1, Map map2) { |
+ var result = {}; |
Bob Nystrom
2015/04/24 21:33:10
result.addAll(map1);
result.addAll(map2);
nweiz
2015/04/24 21:38:06
Done.
|
+ map1.forEach((key, value) { |
+ result[key] = value; |
+ }); |
+ map2.forEach((key, value) { |
+ result[key] = value; |
+ }); |
+ return result; |
+} |
+ |
/// Returns the transitive closure of [graph]. |
/// |
/// This assumes [graph] represents a graph with a vertex for each key and an |