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

Unified Diff: sdk/lib/svg/dartium/svg_dartium.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: 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/svg/dartium/svg_dartium.dart
diff --git a/sdk/lib/svg/dartium/svg_dartium.dart b/sdk/lib/svg/dartium/svg_dartium.dart
index c468fccf358932c29031368e61dba182939df693..ccab93430e731fa92805e36f3bff955c7fc7819b 100644
--- a/sdk/lib/svg/dartium/svg_dartium.dart
+++ b/sdk/lib/svg/dartium/svg_dartium.dart
@@ -3642,6 +3642,16 @@ class LengthList extends NativeFieldWrapperClass1 implements List<Length> {
throw new StateError("No elements");
}
+ Length get single {
+ if (length == 1) return this[0];
+ if (length == 0) throw new StateError("No elements");
+ throw new StateError("More than one element");
+ }
+
+ Length min([int compare(Length a, Length b)]) => _Collections.minInList(this, compare);
+
+ Length max([int compare(Length a, Length b)]) => _Collections.maxInList(this, compare);
+
Length removeAt(int pos) {
throw new UnsupportedError("Cannot removeAt on immutable List.");
}
@@ -4356,6 +4366,16 @@ class NumberList extends NativeFieldWrapperClass1 implements List<Number> {
throw new StateError("No elements");
}
+ Number get single {
+ if (length == 1) return this[0];
+ if (length == 0) throw new StateError("No elements");
+ throw new StateError("More than one element");
+ }
+
+ Number min([int compare(Number a, Number b)]) => _Collections.minInList(this, compare);
+
+ Number max([int compare(Number a, Number b)]) => _Collections.maxInList(this, compare);
+
Number removeAt(int pos) {
throw new UnsupportedError("Cannot removeAt on immutable List.");
}
@@ -5478,6 +5498,16 @@ class PathSegList extends NativeFieldWrapperClass1 implements List<PathSeg> {
throw new StateError("No elements");
}
+ PathSeg get single {
+ if (length == 1) return this[0];
+ if (length == 0) throw new StateError("No elements");
+ throw new StateError("More than one element");
+ }
+
+ PathSeg min([int compare(PathSeg a, PathSeg b)]) => _Collections.minInList(this, compare);
+
+ PathSeg max([int compare(PathSeg a, PathSeg b)]) => _Collections.maxInList(this, compare);
+
PathSeg removeAt(int pos) {
throw new UnsupportedError("Cannot removeAt on immutable List.");
}
@@ -6445,6 +6475,16 @@ class StringList extends NativeFieldWrapperClass1 implements List<String> {
throw new StateError("No elements");
}
+ String get single {
+ if (length == 1) return this[0];
+ if (length == 0) throw new StateError("No elements");
+ throw new StateError("More than one element");
+ }
+
+ String min([int compare(String a, String b)]) => _Collections.minInList(this, compare);
+
+ String max([int compare(String a, String b)]) => _Collections.maxInList(this, compare);
+
String removeAt(int pos) {
throw new UnsupportedError("Cannot removeAt on immutable List.");
}
@@ -7707,6 +7747,16 @@ class TransformList extends NativeFieldWrapperClass1 implements List<Transform>
throw new StateError("No elements");
}
+ Transform get single {
+ if (length == 1) return this[0];
+ if (length == 0) throw new StateError("No elements");
+ throw new StateError("More than one element");
+ }
+
+ Transform min([int compare(Transform a, Transform b)]) => _Collections.minInList(this, compare);
+
+ Transform max([int compare(Transform a, Transform b)]) => _Collections.maxInList(this, compare);
+
Transform removeAt(int pos) {
throw new UnsupportedError("Cannot removeAt on immutable List.");
}
@@ -8251,6 +8301,16 @@ class _ElementInstanceList extends NativeFieldWrapperClass1 implements List<Elem
throw new StateError("No elements");
}
+ ElementInstance get single {
+ if (length == 1) return this[0];
+ if (length == 0) throw new StateError("No elements");
+ throw new StateError("More than one element");
+ }
+
+ ElementInstance min([int compare(ElementInstance a, ElementInstance b)]) => _Collections.minInList(this, compare);
+
+ ElementInstance max([int compare(ElementInstance a, ElementInstance b)]) => _Collections.maxInList(this, compare);
+
ElementInstance removeAt(int pos) {
throw new UnsupportedError("Cannot removeAt on immutable List.");
}

Powered by Google App Engine
This is Rietveld 408576698