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

Unified Diff: sdk/lib/collection/collections.dart

Issue 14065011: Implement getRange (returning an Iterable). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes and status-file update. Created 7 years, 8 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
Index: sdk/lib/collection/collections.dart
diff --git a/sdk/lib/collection/collections.dart b/sdk/lib/collection/collections.dart
index f51d98daaabeb87b5ab5bb1613a0f12e4fd5cc6e..a5cbfafd7d495f909b914f71b9e9365b29153603 100644
--- a/sdk/lib/collection/collections.dart
+++ b/sdk/lib/collection/collections.dart
@@ -322,7 +322,6 @@ class IterableMixinWorkaround {
static Iterable takeList(List list, int n) {
// The generic type is currently lost. It will be fixed with mixins.
- // This is currently a List as well as an Iterable.
return new SubListIterable(list, 0, n);
}
@@ -333,7 +332,6 @@ class IterableMixinWorkaround {
static Iterable skipList(List list, int n) {
// The generic type is currently lost. It will be fixed with mixins.
- // This is currently a List as well as an Iterable.
return new SubListIterable(list, n, null);
}
@@ -360,6 +358,17 @@ class IterableMixinWorkaround {
return Arrays.lastIndexOf(list, element, start);
}
+ static Iterable getRangeList(List list, int start, int end) {
+ if (start < 0 || start > list.length) {
+ throw new RangeError.range(start, 0, list.length);
+ }
+ if (end < start || end > list.length) {
+ throw new RangeError.range(end, start, list.length);
+ }
+ // The generic type is currently lost. It will be fixed with mixins.
+ return new SubListIterable(list, start, end);
+ }
+
static void setRangeList(List list, int start, int length,
List from, int startFrom) {
if (length == 0) return;

Powered by Google App Engine
This is Rietveld 408576698