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

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

Issue 12188011: Added expand method to iterables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months 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/collection_dev/iterable.dart ('k') | sdk/lib/html/dart2js/html_dart2js.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/iterable.dart
diff --git a/sdk/lib/core/iterable.dart b/sdk/lib/core/iterable.dart
index 160e773e574031c479769a02762a3a878e68271c..4f16c1271891e8f6360d04836b4f49e837b11069 100644
--- a/sdk/lib/core/iterable.dart
+++ b/sdk/lib/core/iterable.dart
@@ -58,17 +58,30 @@ abstract class Iterable<E> {
Iterable mappedBy(f(E element)) => map(f);
/**
- * Returns a lazy [Iterable] with all elements that satisfy the
- * predicate [f].
- *
- * This method returns a view of the mapped elements. As long as the
- * returned [Iterable] is not iterated over, the supplied function [f] will
- * not be invoked. Iterating will not cache results, and thus iterating
- * multiple times over the the returned [Iterable] will invoke the supplied
- * function [f] multiple times on the same element.
- */
+ * Returns a lazy [Iterable] with all elements that satisfy the
+ * predicate [f].
+ *
+ * This method returns a view of the mapped elements. As long as the
+ * returned [Iterable] is not iterated over, the supplied function [f] will
+ * not be invoked. Iterating will not cache results, and thus iterating
+ * multiple times over the the returned [Iterable] will invoke the supplied
+ * function [f] multiple times on the same element.
+ */
Iterable<E> where(bool f(E element)) => new WhereIterable<E>(this, f);
+
+ /**
+ * Expand each element of this [Iterable] into zero or more elements.
+ *
+ * The resulting Iterable will run through the elements returned
+ * by [f] for each element of this, in order.
+ *
+ * The returned [Iterable] is lazy, and will call [f] for each element
+ * of this every time it's iterated.
+ */
+ Iterable expand(Iterable f(E element)) =>
+ new ExpandIterable<E, dynamic>(this, f);
+
/**
* Check whether the collection contains an element equal to [element].
*/
« no previous file with comments | « sdk/lib/collection_dev/iterable.dart ('k') | sdk/lib/html/dart2js/html_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698