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

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

Issue 366513002: Print the most recent available version of packages being upgraded. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 6 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 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].

Powered by Google App Engine
This is Rietveld 408576698