| Index: sdk/lib/internal/iterable.dart
|
| diff --git a/sdk/lib/internal/iterable.dart b/sdk/lib/internal/iterable.dart
|
| index 006b31acb6fef4ee6860799d8135c2c10c6b1cfe..78cebced560803c219dfc51a76f37b55fde7eab8 100644
|
| --- a/sdk/lib/internal/iterable.dart
|
| +++ b/sdk/lib/internal/iterable.dart
|
| @@ -226,7 +226,7 @@ abstract class ListIterable<E> extends IterableBase<E>
|
| }
|
|
|
| class SubListIterable<E> extends ListIterable<E> {
|
| - final Iterable<E> _iterable;
|
| + final Iterable<E> _iterable; // Has efficient length and elementAt.
|
| final int _start;
|
| /** If null, represents the length of the iterable. */
|
| final int _endOrLength;
|
| @@ -293,6 +293,21 @@ class SubListIterable<E> extends ListIterable<E> {
|
| return new SubListIterable<E>(_iterable, _start, newEnd);
|
| }
|
| }
|
| +
|
| + List<E> toList({bool growable: false}) {
|
| + int start = _start;
|
| + int end = _iterable.length;
|
| + if (_endOrLength != null && _endOrLength < end) end = _endOrLength;
|
| + int length = end - start;
|
| + if (length < 0) length = 0;
|
| + List result = growable ? (new List<E>()..length = length)
|
| + : new List<E>(length);
|
| + for (int i = 0; i < length; i++) {
|
| + result[i] = _iterable.elementAt(start + i);
|
| + if (_iterable.length < end) throw new ConcurrentModificationError(this);
|
| + }
|
| + return result;
|
| + }
|
| }
|
|
|
| /**
|
|
|