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

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: Address comments. 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
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/js_array.dart ('k') | sdk/lib/collection/list.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/collection/collections.dart
diff --git a/sdk/lib/collection/collections.dart b/sdk/lib/collection/collections.dart
index 95d5a43dedf80fdd0e63f73b14b3e08c63a2b94f..2ff2228cc4a69c6877e069b990a345ce0ef9ccf5 100644
--- a/sdk/lib/collection/collections.dart
+++ b/sdk/lib/collection/collections.dart
@@ -327,7 +327,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);
}
@@ -338,7 +337,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);
}
@@ -365,6 +363,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;
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/js_array.dart ('k') | sdk/lib/collection/list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698