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

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

Issue 2154933002: Add example int doc for Iterable.expand (Closed) Base URL: https://github.com/dart-lang/sdk@master
Patch Set: Created 4 years, 5 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 | « no previous file | no next file » | 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 3e7c1cbd97a3327e64d05cff823dcfb37358c120..52476bafc0ca9244084e31fb7ef879137da48cad 100644
--- a/sdk/lib/core/iterable.dart
+++ b/sdk/lib/core/iterable.dart
@@ -181,6 +181,15 @@ abstract class Iterable<E> {
*
* The returned [Iterable] is lazy, and calls [f] for each element
* of this every time it's iterated.
+ *
+ * Example:
+ *
+ * var lists = [<int>[1, 2, 3], <int>[3, 4, 5]];
+ * Set<int> ints = lists.expand((list) => list).toSet();
+ * print(ints);
floitsch 2016/08/05 09:38:40 I prefer not to write the type arguments and sets:
stanm 2016/08/05 16:48:31 Done.
+ *
+ * > {1, 2, 3, 4, 5}
+ *
*/
Iterable/*<T>*/ expand/*<T>*/(Iterable/*<T>*/ f(E element)) =>
new ExpandIterable<E, dynamic/*=T*/>(this, f);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698