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

Side by Side Diff: sdk/lib/core/iterable.dart

Issue 838463002: Change List/Set/Map/Queue.from constructrs to accept any iterable. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * An object that uses an [Iterator] to serve objects one at a time. 8 * An object that uses an [Iterator] to serve objects one at a time.
9 * 9 *
10 * You can iterate over all objects served by an Iterable object 10 * You can iterate over all objects served by an Iterable object
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 * [:const [0, ..., n - 1].map(generator):] 49 * [:const [0, ..., n - 1].map(generator):]
50 */ 50 */
51 factory Iterable.generate(int count, [E generator(int index)]) { 51 factory Iterable.generate(int count, [E generator(int index)]) {
52 if (count <= 0) return new EmptyIterable<E>(); 52 if (count <= 0) return new EmptyIterable<E>();
53 return new _GeneratorIterable<E>(count, generator); 53 return new _GeneratorIterable<E>(count, generator);
54 } 54 }
55 55
56 /** 56 /**
57 * Returns a new `Iterator` that allows iterating the elements of this 57 * Returns a new `Iterator` that allows iterating the elements of this
58 * `Iterable`. 58 * `Iterable`.
59 *
60 * Modifying the underlying data after creating the new iterator
61 * may cause an error the next time [Iterator.moveNext] is called.
59 */ 62 */
60 Iterator<E> get iterator; 63 Iterator<E> get iterator;
61 64
62 /** 65 /**
63 * Returns a new lazy [Iterable] with elements that are created by 66 * Returns a new lazy [Iterable] with elements that are created by
64 * calling `f` on the elements of this `Iterable`. 67 * calling `f` on the elements of this `Iterable`.
65 * 68 *
66 * This method returns a view of the mapped elements. As long as the 69 * This method returns a view of the mapped elements. As long as the
67 * returned [Iterable] is not iterated over, the supplied function [f] will 70 * returned [Iterable] is not iterated over, the supplied function [f] will
68 * not be invoked. The transformed elements will not be cached. Iterating 71 * not be invoked. The transformed elements will not be cached. Iterating
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 */ 370 */
368 abstract class BidirectionalIterator<E> implements Iterator<E> { 371 abstract class BidirectionalIterator<E> implements Iterator<E> {
369 /** 372 /**
370 * Move back to the previous element. 373 * Move back to the previous element.
371 * 374 *
372 * Returns true and updates [current] if successful. Returns false 375 * Returns true and updates [current] if successful. Returns false
373 * and sets [current] to null if there is no previous element. 376 * and sets [current] to null if there is no previous element.
374 */ 377 */
375 bool movePrevious(); 378 bool movePrevious();
376 } 379 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698