| 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..a6fa15dc9ff1b737a146e82f3e7fd1dfd07030d5 100644
|
| --- a/sdk/lib/_internal/pub/lib/src/utils.dart
|
| +++ b/sdk/lib/_internal/pub/lib/src/utils.dart
|
| @@ -167,6 +167,18 @@ String padRight(String source, int length) {
|
| return result.toString();
|
| }
|
|
|
| +/// Returns a labelled sentence fragment starting with [name] listing the
|
| +/// elements [iter].
|
| +///
|
| +/// If [iter] does not have one item, name will be pluralized by adding "s" or
|
| +/// using [plural], if given.
|
| +String namedSequence(String name, Iterable iter, [String plural]) {
|
| + if (iter.length == 1) return "$name ${iter.single}";
|
| +
|
| + if (plural == null) plural = "${name}s";
|
| + return "$plural ${toSentence(iter)}";
|
| +}
|
| +
|
| /// Returns a sentence fragment listing the elements of [iter].
|
| ///
|
| /// This converts each element of [iter] to a string and separates them with
|
| @@ -264,6 +276,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();
|
|
|