| Index: sdk/lib/internal/iterable.dart
|
| diff --git a/sdk/lib/internal/iterable.dart b/sdk/lib/internal/iterable.dart
|
| index 47c94f8b0be8975c60745e36a5f9440922feae5b..0a59b0ea258941304f0e1a89e51b4e8d71eef940 100644
|
| --- a/sdk/lib/internal/iterable.dart
|
| +++ b/sdk/lib/internal/iterable.dart
|
| @@ -5,27 +5,13 @@
|
| part of dart._internal;
|
|
|
| /**
|
| - * Marker interface for [Iterable] subclasses that have an efficient
|
| - * [length] implementation.
|
| - */
|
| -abstract class EfficientLength {
|
| - /**
|
| - * Returns the number of elements in the iterable.
|
| - *
|
| - * This is an efficient operation that doesn't require iterating through
|
| - * the elements.
|
| - */
|
| - int get length;
|
| -}
|
| -
|
| -/**
|
| * An [Iterable] for classes that have efficient [length] and [elementAt].
|
| *
|
| * All other methods are implemented in terms of [length] and [elementAt],
|
| * including [iterator].
|
| */
|
| abstract class ListIterable<E> extends Iterable<E>
|
| - implements EfficientLength {
|
| + implements EfficientLengthIterable<E> {
|
| int get length;
|
| E elementAt(int i);
|
|
|
| @@ -351,7 +337,7 @@ class MappedIterable<S, T> extends Iterable<T> {
|
| final _Transformation<S, T> _f;
|
|
|
| factory MappedIterable(Iterable iterable, T function(S value)) {
|
| - if (iterable is EfficientLength) {
|
| + if (iterable is EfficientLengthIterable) {
|
| return new EfficientLengthMappedIterable<S, T>(iterable, function);
|
| }
|
| return new MappedIterable<S, T>._(iterable, function);
|
| @@ -373,7 +359,7 @@ class MappedIterable<S, T> extends Iterable<T> {
|
| }
|
|
|
| class EfficientLengthMappedIterable<S, T> extends MappedIterable<S, T>
|
| - implements EfficientLength {
|
| + implements EfficientLengthIterable<T> {
|
| EfficientLengthMappedIterable(Iterable iterable, T function(S value))
|
| : super._(iterable, function);
|
| }
|
| @@ -402,8 +388,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 EfficientLength {
|
| +class MappedListIterable<S, T> extends ListIterable<T> {
|
| final Iterable<S> _source;
|
| final _Transformation<S, T> _f;
|
|
|
| @@ -496,7 +481,7 @@ class TakeIterable<E> extends Iterable<E> {
|
| if (takeCount is! int || takeCount < 0) {
|
| throw new ArgumentError(takeCount);
|
| }
|
| - if (iterable is EfficientLength) {
|
| + if (iterable is EfficientLengthIterable) {
|
| return new EfficientLengthTakeIterable<E>(iterable, takeCount);
|
| }
|
| return new TakeIterable<E>._(iterable, takeCount);
|
| @@ -510,7 +495,7 @@ class TakeIterable<E> extends Iterable<E> {
|
| }
|
|
|
| class EfficientLengthTakeIterable<E> extends TakeIterable<E>
|
| - implements EfficientLength {
|
| + implements EfficientLengthIterable<E> {
|
| EfficientLengthTakeIterable(Iterable<E> iterable, int takeCount)
|
| : super._(iterable, takeCount);
|
|
|
| @@ -583,7 +568,7 @@ class SkipIterable<E> extends Iterable<E> {
|
| final int _skipCount;
|
|
|
| factory SkipIterable(Iterable<E> iterable, int count) {
|
| - if (iterable is EfficientLength) {
|
| + if (iterable is EfficientLengthIterable) {
|
| return new EfficientLengthSkipIterable<E>(iterable, count);
|
| }
|
| return new SkipIterable<E>._(iterable, count);
|
| @@ -610,7 +595,7 @@ class SkipIterable<E> extends Iterable<E> {
|
| }
|
|
|
| class EfficientLengthSkipIterable<E> extends SkipIterable<E>
|
| - implements EfficientLength {
|
| + implements EfficientLengthIterable<E> {
|
| EfficientLengthSkipIterable(Iterable<E> iterable, int skipCount)
|
| : super._(iterable, skipCount);
|
|
|
| @@ -672,7 +657,8 @@ class SkipWhileIterator<E> extends Iterator<E> {
|
| /**
|
| * The always empty [Iterable].
|
| */
|
| -class EmptyIterable<E> extends Iterable<E> implements EfficientLength {
|
| +class EmptyIterable<E> extends Iterable<E>
|
| + implements EfficientLengthIterable<E> {
|
| const EmptyIterable();
|
|
|
| Iterator<E> get iterator => const EmptyIterator();
|
|
|