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

Unified Diff: sdk/lib/internal/iterable.dart

Issue 2467283003: Revert "Make EfficientLength extend Iterable." (Closed)
Patch Set: Created 4 years, 1 month 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 | « sdk/lib/core/set.dart ('k') | tests/corelib/growable_list_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/internal/iterable.dart
diff --git a/sdk/lib/internal/iterable.dart b/sdk/lib/internal/iterable.dart
index 73b3669f5fc84facba92303c9b344cafd9a58313..0e7b171e26002c4aa73f57516a1b7246196dee82 100644
--- a/sdk/lib/internal/iterable.dart
+++ b/sdk/lib/internal/iterable.dart
@@ -8,8 +8,7 @@ part of dart._internal;
* Marker interface for [Iterable] subclasses that have an efficient
* [length] implementation.
*/
-abstract class EfficientLengthIterable<T> extends Iterable<T> {
- const EfficientLengthIterable();
+abstract class EfficientLength {
/**
* Returns the number of elements in the iterable.
*
@@ -25,7 +24,8 @@ abstract class EfficientLengthIterable<T> extends Iterable<T> {
* All other methods are implemented in terms of [length] and [elementAt],
* including [iterator].
*/
-abstract class ListIterable<E> extends EfficientLengthIterable<E> {
+abstract class ListIterable<E> extends Iterable<E>
+ implements EfficientLength {
int get length;
E elementAt(int i);
@@ -354,7 +354,7 @@ class MappedIterable<S, T> extends Iterable<T> {
final _Transformation<S, T> _f;
factory MappedIterable(Iterable<S> iterable, T function(S value)) {
- if (iterable is EfficientLengthIterable) {
+ if (iterable is EfficientLength) {
return new EfficientLengthMappedIterable<S, T>(iterable, function);
}
return new MappedIterable<S, T>._(iterable, function);
@@ -376,7 +376,7 @@ class MappedIterable<S, T> extends Iterable<T> {
}
class EfficientLengthMappedIterable<S, T> extends MappedIterable<S, T>
- implements EfficientLengthIterable<T> {
+ implements EfficientLength {
EfficientLengthMappedIterable(Iterable<S> iterable, T function(S value))
: super._(iterable, function);
}
@@ -406,7 +406,7 @@ class MappedIterator<S, T> extends Iterator<T> {
* Expects efficient `length` and `elementAt` on the source iterable.
*/
class MappedListIterable<S, T> extends ListIterable<T>
- implements EfficientLengthIterable<T> {
+ implements EfficientLength {
final Iterable<S> _source;
final _Transformation<S, T> _f;
@@ -427,7 +427,7 @@ class WhereIterable<E> extends Iterable<E> {
Iterator<E> get iterator => new WhereIterator<E>(_iterable.iterator, _f);
- // Specialization of [Iterable.map] to non-EfficientLengthIterable.
+ // Specialization of [Iterable.map] to non-EfficientLength.
Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(E element)) =>
new MappedIterable<E, dynamic/*=T*/>._(this, f);
}
@@ -500,7 +500,7 @@ class TakeIterable<E> extends Iterable<E> {
if (takeCount is! int || takeCount < 0) {
throw new ArgumentError(takeCount);
}
- if (iterable is EfficientLengthIterable) {
+ if (iterable is EfficientLength) {
return new EfficientLengthTakeIterable<E>(iterable, takeCount);
}
return new TakeIterable<E>._(iterable, takeCount);
@@ -514,7 +514,7 @@ class TakeIterable<E> extends Iterable<E> {
}
class EfficientLengthTakeIterable<E> extends TakeIterable<E>
- implements EfficientLengthIterable<E> {
+ implements EfficientLength {
EfficientLengthTakeIterable(Iterable<E> iterable, int takeCount)
: super._(iterable, takeCount);
@@ -587,7 +587,7 @@ class SkipIterable<E> extends Iterable<E> {
final int _skipCount;
factory SkipIterable(Iterable<E> iterable, int count) {
- if (iterable is EfficientLengthIterable) {
+ if (iterable is EfficientLength) {
return new EfficientLengthSkipIterable<E>(iterable, count);
}
return new SkipIterable<E>._(iterable, count);
@@ -614,7 +614,7 @@ class SkipIterable<E> extends Iterable<E> {
}
class EfficientLengthSkipIterable<E> extends SkipIterable<E>
- implements EfficientLengthIterable<E> {
+ implements EfficientLength {
EfficientLengthSkipIterable(Iterable<E> iterable, int skipCount)
: super._(iterable, skipCount);
@@ -676,7 +676,7 @@ class SkipWhileIterator<E> extends Iterator<E> {
/**
* The always empty [Iterable].
*/
-class EmptyIterable<E> extends EfficientLengthIterable<E> {
+class EmptyIterable<E> extends Iterable<E> implements EfficientLength {
const EmptyIterable();
Iterator<E> get iterator => const EmptyIterator();
« no previous file with comments | « sdk/lib/core/set.dart ('k') | tests/corelib/growable_list_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698