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

Unified Diff: sdk/lib/async/future.dart

Issue 2657563003: Add a generic type to Future.forEach. (Closed)
Patch Set: Created 3 years, 11 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/async/future.dart
diff --git a/sdk/lib/async/future.dart b/sdk/lib/async/future.dart
index 674fffd7bfd2c93e2aa71dca4307c50378681c0c..5fb5c022097ef4bacc939853aaf3d7e67ba2cda5 100644
--- a/sdk/lib/async/future.dart
+++ b/sdk/lib/async/future.dart
@@ -418,8 +418,8 @@ abstract class Future<T> {
* If [f] returns a non-[Future], iteration continues immediately. Otherwise
* it waits for the returned [Future] to complete.
*/
- static Future forEach(Iterable input, f(element)) {
- Iterator iterator = input.iterator;
+ static Future forEach<T>(Iterable<T> input, f(T element)) {
+ var iterator = input.iterator;
return doWhile(() {
if (!iterator.moveNext()) return false;
return new Future.sync(() => f(iterator.current)).then((_) => true);
« 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