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

Side by Side Diff: sdk/lib/collection/collections.dart

Issue 12094103: Added MappedListIterable/Iterator to implement map() on Lists. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adding missing EmptyIteartor/Iterable 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.collection; 5 part of dart.collection;
6 6
7 /** 7 /**
8 * This class provides default implementations for Iterables (including Lists). 8 * This class provides default implementations for Iterables (including Lists).
9 * 9 *
10 * Once Dart receives Mixins it will be replaced with mixin classes. 10 * Once Dart receives Mixins it will be replaced with mixin classes.
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 310 }
311 311
312 static Iterable where(Iterable iterable, bool f(var element)) { 312 static Iterable where(Iterable iterable, bool f(var element)) {
313 return new WhereIterable(iterable, f); 313 return new WhereIterable(iterable, f);
314 } 314 }
315 315
316 static Iterable map(Iterable iterable, f(var element)) { 316 static Iterable map(Iterable iterable, f(var element)) {
317 return new MappedIterable(iterable, f); 317 return new MappedIterable(iterable, f);
318 } 318 }
319 319
320 static Iterable mapList(List list, f(var element)) {
321 return new MappedListIterable(list, f, 0, null);
322 }
323
320 static List mappedByList(List list, f(var element)) { 324 static List mappedByList(List list, f(var element)) {
321 // This is currently a List as well as an Iterable. 325 // This is currently a List as well as an Iterable.
322 return new MappedList(list, f); 326 return new MappedList(list, f);
323 } 327 }
324 328
325 static Iterable takeList(List list, int n) { 329 static Iterable takeList(List list, int n) {
326 // The generic type is currently lost. It will be fixed with mixins. 330 // The generic type is currently lost. It will be fixed with mixins.
327 // This is currently a List as well as an Iterable. 331 // This is currently a List as well as an Iterable.
328 return new ListView(list, 0, n); 332 return new ListView(list, 0, n);
329 } 333 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 static Iterable skipList(List list, int n) 465 static Iterable skipList(List list, int n)
462 => IterableMixinWorkaround.skipList(list, n); 466 => IterableMixinWorkaround.skipList(list, n);
463 467
464 /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/ 468 /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
465 static Iterable skipWhile(Iterable iterable, bool test(var value)) 469 static Iterable skipWhile(Iterable iterable, bool test(var value))
466 => IterableMixinWorkaround.skipWhile(iterable, test); 470 => IterableMixinWorkaround.skipWhile(iterable, test);
467 471
468 static String collectionToString(Collection c) 472 static String collectionToString(Collection c)
469 => ToString.collectionToString(c); 473 => ToString.collectionToString(c);
470 } 474 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/js_array.dart ('k') | sdk/lib/collection_dev/iterable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698