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

Unified Diff: lib/src/utils.dart

Issue 1405633004: feature: tag tests; choose tags on command line Base URL: git@github.com:yjbanov/test.git@tags
Patch Set: Created 5 years, 2 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: lib/src/utils.dart
diff --git a/lib/src/utils.dart b/lib/src/utils.dart
index 7793d3084deaa94f9493ecd1f7b64039ea32b181..4516351a9bbe2bf943a8d4b512363611ed8a3d90 100644
--- a/lib/src/utils.dart
+++ b/lib/src/utils.dart
@@ -189,6 +189,19 @@ Map mergeMaps(Map map1, Map map2) {
return result;
}
+/// Returns a new list with all elements in both [list1] and [list2].
+///
+/// If an element exists in both lists, it is listed only once in the result.
+List mergeLists(List list1, List list2) {
+ var result = []..addAll(list1);
+ list2.forEach((element) {
+ if (!result.contains(element)) {
+ result.add(element);
+ }
+ });
+ return result;
+}
+
/// Returns a sink that maps events sent to [original] using [fn].
StreamSink mapSink(StreamSink original, fn(event)) {
var controller = new StreamController(sync: true);
@@ -403,3 +416,9 @@ shelf.Middleware nestingMiddleware(String beneath) {
return pathHandler.handler;
};
}
+
+/// Returns `true` iff [a] and [b] are both not null and share at least one
+/// element.
+bool intersect(Iterable a, Iterable b) {
+ return a != null && b != null && a.any(b.contains);
+}

Powered by Google App Engine
This is Rietveld 408576698