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

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

Issue 12262037: Make List.skip, List.take and List.reversed return Iterables, not Lists. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments, small fixes. Created 7 years, 10 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/core/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 81dd6da380856b7cbeae9a3322a3fd3bdbcf1a0c..18c1d7b73c02e56818d2f213cffe382095815990 100644
--- a/sdk/lib/collection/collections.dart
+++ b/sdk/lib/collection/collections.dart
@@ -318,7 +318,7 @@ class IterableMixinWorkaround {
}
static Iterable mapList(List list, f(var element)) {
- return new MappedListIterable(list, f, 0, null);
+ return new MappedListIterable(list, f);
}
static List mappedByList(List list, f(var element)) {
@@ -333,7 +333,7 @@ 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 ListView(list, 0, n);
+ return new SubListIterable(list, 0, n);
}
static Iterable takeWhile(Iterable iterable, bool test(var value)) {
@@ -344,7 +344,7 @@ 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 ListView(list, n, null);
+ return new SubListIterable(list, n, null);
}
static Iterable skipWhile(Iterable iterable, bool test(var value)) {
@@ -352,8 +352,8 @@ class IterableMixinWorkaround {
return new SkipWhileIterable(iterable, test);
}
- static List reversedList(List l) {
- return new ReversedListView(l, 0, null);
+ static Iterable reversedList(List l) {
+ return new ReversedListIterable(l);
}
static void sortList(List l, int compare(a, b)) {
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/js_array.dart ('k') | sdk/lib/core/list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698