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

Unified Diff: sdk/lib/_internal/pub/lib/src/utils.dart

Issue 576333002: Precompile immutable dependencies on "pub get". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years, 3 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/_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 7af41e5f7ec03bef60391c16a6976a58a347ddf8..a3744576020309e72161ee3ec168bae5d2ef076c 100644
--- a/sdk/lib/_internal/pub/lib/src/utils.dart
+++ b/sdk/lib/_internal/pub/lib/src/utils.dart
@@ -264,6 +264,14 @@ Set setMinus(Iterable minuend, Iterable subtrahend) {
return minuendSet;
}
+/// Returns whether there's any overlap between [set1] and [set2].
+bool overlaps(Set set1, Set set2) {
+ // Iterate through the smaller set.
+ var smaller = set1.length > set2.length ? set1 : set2;
+ var larger = smaller == set1 ? set2 : set1;
+ return smaller.any(larger.contains);
+}
+
/// Returns a list containing the sorted elements of [iter].
List ordered(Iterable<Comparable> iter) {
var list = iter.toList();

Powered by Google App Engine
This is Rietveld 408576698