| 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 eaf34f7c64838958b789e7f1803767366c2b6d03..b3d585db92a97b0ebc12d379dd741e25fa0fe382 100644
|
| --- a/sdk/lib/_internal/pub/lib/src/utils.dart
|
| +++ b/sdk/lib/_internal/pub/lib/src/utils.dart
|
| @@ -359,9 +359,14 @@ Set<String> createDirectoryFilter(Iterable<String> dirs) {
|
| }).toSet();
|
| }
|
|
|
| -/// Returns the maximum value in [iter].
|
| -int maxAll(Iterable<int> iter) =>
|
| - iter.reduce((max, element) => element > max ? element : max);
|
| +/// Returns the maximum value in [iter] by [compare].
|
| +///
|
| +/// [compare] defaults to [Comparable.compare].
|
| +maxAll(Iterable iter, [int compare(element1, element2)]) {
|
| + if (compare == null) compare = Comparable.compare;
|
| + return iter.reduce((max, element) =>
|
| + compare(element, max) > 0 ? element : max);
|
| +}
|
|
|
| /// Replace each instance of [matcher] in [source] with the return value of
|
| /// [fn].
|
|
|