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

Unified Diff: runtime/lib/growable_array.dart

Issue 11971016: Create IterableMixinWorkaround and move most of the Collections methods there. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typo (mappedByList instead of mappedBy). Created 7 years, 11 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
« no previous file with comments | « runtime/lib/byte_array.dart ('k') | samples/swarm/DataSource.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/growable_array.dart
diff --git a/runtime/lib/growable_array.dart b/runtime/lib/growable_array.dart
index 0b384a8c54b8da0c3dec39f4085b2202f9a6d9dd..3466ec0fc2fc6455c1e33d4fc73fce07885443f6 100644
--- a/runtime/lib/growable_array.dart
+++ b/runtime/lib/growable_array.dart
@@ -163,9 +163,9 @@ class _GrowableObjectArray<T> implements List<T> {
throw new StateError("More than one element");
}
- T min([int compare(T a, T b)]) => Collections.min(this, compare);
+ T min([int compare(T a, T b)]) => IterableMixinWorkaround.min(this, compare);
- T max([int compare(T a, T b)]) => Collections.max(this, compare);
+ T max([int compare(T a, T b)]) => IterableMixinWorkaround.max(this, compare);
int indexOf(T element, [int start = 0]) {
return Arrays.indexOf(this, element, start, length);
@@ -187,11 +187,11 @@ class _GrowableObjectArray<T> implements List<T> {
// Collection interface.
bool contains(T element) {
- return Collections.contains(this, element);
+ return IterableMixinWorkaround.contains(this, element);
}
void forEach(f(T element)) {
- // TODO(srdjan): Use Collections.forEach(this, f);
+ // TODO(srdjan): Use IterableMixinWorkaround.forEach(this, f);
// Accessing the list directly improves DeltaBlue performance by 25%.
for (int i = 0; i < length; i++) {
f(this[i]);
@@ -217,51 +217,51 @@ class _GrowableObjectArray<T> implements List<T> {
}
List mappedBy(f(T element)) {
- return new MappedList<T, dynamic>(this, f);
+ return IterableMixinWorkaround.mappedByList(this, f);
}
reduce(initialValue, combine(previousValue, T element)) {
- return Collections.reduce(this, initialValue, combine);
+ return IterableMixinWorkaround.reduce(this, initialValue, combine);
}
Iterable<T> where(bool f(T element)) {
- return new WhereIterable<T>(this, f);
+ return IterableMixinWorkaround.where(this, f);
}
List<T> take(int n) {
- return new ListView<T>(this, 0, n);
+ return IterableMixinWorkaround.takeList(this, n);
}
Iterable<T> takeWhile(bool test(T value)) {
- return new TakeWhileIterable<T>(this, test);
+ return IterableMixinWorkaround.takeWhile(this, test);
}
List<T> skip(int n) {
- return new ListView<T>(this, n, null);
+ return IterableMixinWorkaround.skipList(this, n);
}
Iterable<T> skipWhile(bool test(T value)) {
- return new SkipWhileIterable<T>(this, test);
+ return IterableMixinWorkaround.skipWhile(this, test);
}
bool every(bool f(T element)) {
- return Collections.every(this, f);
+ return IterableMixinWorkaround.every(this, f);
}
bool any(bool f(T element)) {
- return Collections.any(this, f);
+ return IterableMixinWorkaround.any(this, f);
}
T firstMatching(bool test(T value), {T orElse()}) {
- return Collections.firstMatching(this, test, orElse);
+ return IterableMixinWorkaround.firstMatching(this, test, orElse);
}
T lastMatching(bool test(T value), {T orElse()}) {
- return Collections.lastMatchingInList(this, test, orElse);
+ return IterableMixinWorkaround.lastMatchingInList(this, test, orElse);
}
T singleMatching(bool test(T value)) {
- return Collections.singleMatching(this, test);
+ return IterableMixinWorkaround.singleMatching(this, test);
}
T elementAt(int index) {
« no previous file with comments | « runtime/lib/byte_array.dart ('k') | samples/swarm/DataSource.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698