Chromium Code Reviews| Index: sdk/lib/collection_dev/list.dart |
| diff --git a/sdk/lib/collection_dev/list.dart b/sdk/lib/collection_dev/list.dart |
| index 09d6deb238b7962704f38020b6e965fcd18d2a86..17a901ef59ee8ac657533a1d0f469b611b85851f 100644 |
| --- a/sdk/lib/collection_dev/list.dart |
| +++ b/sdk/lib/collection_dev/list.dart |
| @@ -5,6 +5,79 @@ |
| part of dart.collection.dev; |
| /** |
| + * A wrapper for any [Iterable] that only exposes the [Iterable] interface. |
| + */ |
| +class IterableView<E> extends Iterable<E> { |
|
floitsch
2013/02/01 15:00:36
Is this class used?
Lasse Reichstein Nielsen
2013/02/01 15:13:57
Whoops, no. Didn't need it anyway, and forgot to r
|
| + final Iterable<E> _source; |
| + |
| + IterableView(this._source); |
| + |
| + Iterator<E> get iterator => _source.iterator; |
| + |
| + void forEach(void action(E element)) { |
| + _source.forEach(action); |
| + } |
| + |
| + bool get isEmpty => _source.isEmpty; |
| + |
| + int get length => _source.length; |
| + |
| + E get first => _source.first; |
| + |
| + E get last => _source.last; |
| + |
| + E get single => _source.single; |
| + |
| + E elementAt(int index) => _source.elementAt(index); |
| + |
| + bool contains(E element) => _source.contains(element); |
| + |
| + bool every(bool test(E element)) => _source.every(test); |
| + |
| + bool any(bool test(E element)) => _source.any(test); |
| + |
| + E firstMatching(bool test(E element), { E orElse() }) { |
| + return _source.firstMatching(test, orElse: orElse); |
| + } |
| + |
| + E lastMatching(bool test(E element), { E orElse() }) { |
| + return _source.lastMatching(test, orElse: orElse); |
| + } |
| + |
| + E singleMatching(bool test(E element), { E orElse() }) { |
| + return _source.singleMatching(test, orElse: orElse); |
| + } |
| + |
| + int min([int compare(E a, E b)]) => _source.min(compare); |
| + |
| + int max([int compare(E a, E b)]) => _source.max(compare); |
| + |
| + String join([String separator]) => _source.join(separator); |
| + |
| + Iterable<E> where(bool test(E element)) => _source.where(test); |
| + |
| + Iterable map(f(E element)) => _source.map(f); |
| + |
| + Iterable mappedBy(f(E element)) => _source.mappedBy(f); |
| + |
| + reduce(var initialValue, combine(var previousValue, E element)) { |
| + return _source.reduce(initialValue, combine); |
| + } |
| + |
| + Iterable<E> skip(int count) => _source.skip(count); |
| + |
| + Iterable<E> skipWhile(bool test(E element)) => _source.skipWhile(test); |
| + |
| + Iterable<E> take(int count) => _source.take(count); |
| + |
| + Iterable<E> takeWhile(bool test(E element)) => _source.takeWhile(test); |
| + |
| + List toList() => _source.toList(); |
| + |
| + Set toSet() => _source.toSet(); |
| +} |
| + |
| +/** |
| * Class implementing the read-operations on [List]. |
| * |
| * Implements all read-only operations, except [:operator[]:] and [:length:], |