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

Unified Diff: sdk/lib/_internal/compiler/implementation/tree/nodes.dart

Issue 11727007: Add min and max to Iterable and Stream. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Address review comments. Fix T->E in Iterable. Created 7 years, 12 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/compiler/implementation/tree/nodes.dart
diff --git a/sdk/lib/_internal/compiler/implementation/tree/nodes.dart b/sdk/lib/_internal/compiler/implementation/tree/nodes.dart
index 8a4f98a1adc1344c8756e5f0c8e5862229890d3c..8099a56c4306542c52c68f827fc6e3056918bf13 100644
--- a/sdk/lib/_internal/compiler/implementation/tree/nodes.dart
+++ b/sdk/lib/_internal/compiler/implementation/tree/nodes.dart
@@ -541,6 +541,10 @@ class NodeList extends Node implements Iterable<Node> {
return Collections.single(this);
}
+ Node min([int compare(Node a, Node b)]) => Collections.min(this, compare);
+
+ Node max([int compare(Node a, Node b)]) => Collections.max(this, compare);
+
Node firstMatching(bool test(Node value), {Node orElse()}) {
return Collections.firstMatching(this, test, orElse);
}

Powered by Google App Engine
This is Rietveld 408576698