| Index: sdk/lib/core/iterable.dart
|
| diff --git a/sdk/lib/core/iterable.dart b/sdk/lib/core/iterable.dart
|
| index 603a9df1a1e5ef04a740d127c4dcb83b6f97685b..f3cfa9354aa126d6d0df399dae4b52ca623f6c24 100644
|
| --- a/sdk/lib/core/iterable.dart
|
| +++ b/sdk/lib/core/iterable.dart
|
| @@ -15,6 +15,8 @@
|
| * be used as the right-hand side of a for-in construct.
|
| */
|
| abstract class Iterable<E> {
|
| + const Iterable();
|
| +
|
| /**
|
| * Returns an [Iterator] that iterates over this [Iterable] object.
|
| */
|
| @@ -28,7 +30,13 @@ abstract class Iterable<E> {
|
| * to return a collection of the same general type as themselves.
|
| * E.g., [List.mappedBy] should return a [List].
|
| */
|
| - Collection mappedBy(f(E element));
|
| + Collection mappedBy(f(E element)) {
|
| + // TODO(floitsch): this is just a temporary function to provide a complete
|
| + // skeleton. It will be changed to become lazy soon.
|
| + List result = [];
|
| + for (E element in this) result.add(f(element));
|
| + return result;
|
| + }
|
|
|
| /**
|
| * Returns a collection with the elements of this collection
|
| @@ -40,7 +48,13 @@ abstract class Iterable<E> {
|
| * An element satisfies the predicate [f] if [:f(element):]
|
| * returns true.
|
| */
|
| - Collection<E> where(bool f(E element));
|
| + Collection<E> where(bool f(E element)) {
|
| + // TODO(floitsch): this is just a temporary function to provide a complete
|
| + // skeleton. It will be changed to become lazy soon.
|
| + List result = <E>[];
|
| + for (E element in this) if (f(element)) result.add(element);
|
| + return result;
|
| + }
|
|
|
| /**
|
| * Check whether the collection contains an element equal to [element].
|
| @@ -69,8 +83,8 @@ abstract class Iterable<E> {
|
| *
|
| * collection.reduce(0, (prev, element) => prev + element);
|
| */
|
| - Dynamic reduce(var initialValue,
|
| - Dynamic combine(var previousValue, E element)) {
|
| + dynamic reduce(var initialValue,
|
| + dynamic combine(var previousValue, E element)) {
|
| var value = initialValue;
|
| for (E element in this) value = combine(value, element);
|
| return value;
|
|
|