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

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

Issue 551063003: Add Iterable.range, List.range and int.to. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 | sdk/lib/core/iterable.dart » ('j') | sdk/lib/core/iterable.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/int.dart
diff --git a/sdk/lib/core/int.dart b/sdk/lib/core/int.dart
index 173356885e24cbff22684a06c5825899d93e22c3..a973f7f7c1ef1e5a871490fb75955997d7adeb9d 100644
--- a/sdk/lib/core/int.dart
+++ b/sdk/lib/core/int.dart
@@ -275,4 +275,21 @@ abstract class int extends num {
external static int parse(String source,
{ int radix,
int onError(String source) });
+
+ /**
+ * Create an `Iterable<int>` iterating from `this` to `to`, inclusive.
+ *
+ * The iteration starts with `this` as the first value, and then
+ * progresses towards `to` in increments of `step`, and stops when reaching
+ * or overshooting `to`. If it hits `to` the `to` value is included,
+ * otherwise it isn't.
+ *
+ * If `to` is less than `from`, the values are in decreasing order.
+ *
+ * The [step] value must always be positive. It defaults to `1`.
+ *
+ * This is a shorthand for [Iterable.range].
+ */
+ static Iterable<int> to(int to, {int step: 1}) =>
+ return Iterable.range(this, to, step);
}
« no previous file with comments | « no previous file | sdk/lib/core/iterable.dart » ('j') | sdk/lib/core/iterable.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698