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

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

Issue 12188011: Added expand method to iterables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 319
320 static Iterable mapList(List list, f(var element)) { 320 static Iterable mapList(List list, f(var element)) {
321 return new MappedListIterable(list, f, 0, null); 321 return new MappedListIterable(list, f, 0, null);
322 } 322 }
323 323
324 static List mappedByList(List list, f(var element)) { 324 static List mappedByList(List list, f(var element)) {
325 // This is currently a List as well as an Iterable. 325 // This is currently a List as well as an Iterable.
326 return new MappedList(list, f); 326 return new MappedList(list, f);
327 } 327 }
328 328
329 static Iterable expand(Iterable iterable, Iterable f(var element)) {
330 return new ExpandIterable(iterable, f);
331 }
332
329 static Iterable takeList(List list, int n) { 333 static Iterable takeList(List list, int n) {
330 // The generic type is currently lost. It will be fixed with mixins. 334 // The generic type is currently lost. It will be fixed with mixins.
331 // This is currently a List as well as an Iterable. 335 // This is currently a List as well as an Iterable.
332 return new ListView(list, 0, n); 336 return new ListView(list, 0, n);
333 } 337 }
334 338
335 static Iterable takeWhile(Iterable iterable, bool test(var value)) { 339 static Iterable takeWhile(Iterable iterable, bool test(var value)) {
336 // The generic type is currently lost. It will be fixed with mixins. 340 // The generic type is currently lost. It will be fixed with mixins.
337 return new TakeWhileIterable(iterable, test); 341 return new TakeWhileIterable(iterable, test);
338 } 342 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 static Iterable skipList(List list, int n) 469 static Iterable skipList(List list, int n)
466 => IterableMixinWorkaround.skipList(list, n); 470 => IterableMixinWorkaround.skipList(list, n);
467 471
468 /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/ 472 /** Deprecated. Use the same method in [IterableMixinWorkaround] instead.*/
469 static Iterable skipWhile(Iterable iterable, bool test(var value)) 473 static Iterable skipWhile(Iterable iterable, bool test(var value))
470 => IterableMixinWorkaround.skipWhile(iterable, test); 474 => IterableMixinWorkaround.skipWhile(iterable, test);
471 475
472 static String collectionToString(Collection c) 476 static String collectionToString(Collection c)
473 => ToString.collectionToString(c); 477 => ToString.collectionToString(c);
474 } 478 }
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