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

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

Issue 23522037: one-liners for the remaining top-50 dart:core classes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: incorporate memfeedback Created 7 years, 3 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.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * The [Iterator] class provides methods to iterate over an object. It 8 * An interface for getting items, one at a time, from an object.
9 * is transparently used by the for-in construct to test for the end 9 *
10 * of the iteration, and to get the elements. 10 * The for-in construct transparently uses Iterator to test for the end
Lasse Reichstein Nielsen 2016/08/31 18:57:36 `Iterator`
11 * of the iteration, and to get each item (or _element_).
11 * 12 *
12 * If the object iterated over is changed during the iteration, the 13 * If the object iterated over is changed during the iteration, the
13 * behavior is unspecified. 14 * behavior is unspecified.
14 * 15 *
15 * The [Iterator] is initially positioned before the first element. Before 16 * The Iterator is initially positioned before the first element. Before
16 * accessing the first element the iterator must thus be advanced ([moveNext]) 17 * accessing the first element the iterator must thus be advanced ([moveNext])
17 * to point to the first element. If there is no element left, then [moveNext] 18 * to point to the first element. If no element is left, then [moveNext]
18 * returns false. 19 * returns false.
19 * 20 *
20 * A typical usage of an [Iterator] looks as follows: 21 * A typical usage of an Iterator looks as follows:
Lasse Reichstein Nielsen 2016/08/31 18:57:36 `Iterator`
21 * 22 *
22 * var it = obj.iterator; 23 * var it = obj.iterator;
23 * while (it.moveNext()) { 24 * while (it.moveNext()) {
24 * use(it.current); 25 * use(it.current);
25 * } 26 * }
27 *
28 * **See also:** [Iteration]
29 * (http://www.dartlang.org/docs/dart-up-and-running/contents/ch03.html#ch03-ite ration)
kevmoo 2016/08/31 21:07:51 https please
30 * in the [library tour]
31 * (http://www.dartlang.org/docs/dart-up-and-running/contents/ch03.html)
26 */ 32 */
27 abstract class Iterator<E> { 33 abstract class Iterator<E> {
28 /** 34 /**
29 * Moves to the next element. Returns true if [current] contains the next 35 * Moves to the next element. Returns true if [current] contains the next
30 * element. Returns false, if no element was left. 36 * element. Returns false, if no element was left.
31 * 37 *
32 * It is safe to invoke [moveNext] even when the iterator is already 38 * It is safe to invoke [moveNext] even when the iterator is already
33 * positioned after the last element. In this case [moveNext] has no effect. 39 * positioned after the last element. In this case [moveNext] has no effect.
34 */ 40 */
35 bool moveNext(); 41 bool moveNext();
36 42
37 /** 43 /**
38 * Returns the current element. 44 * Returns the current element.
39 * 45 *
40 * Return [:null:] if the iterator has not yet been moved to the first 46 * Return [:null:] if the iterator has not yet been moved to the first
41 * element, or if the iterator has been moved after the last element of the 47 * element, or if the iterator has been moved after the last element of the
42 * [Iterable]. 48 * [Iterable].
43 */ 49 */
44 E get current; 50 E get current;
45 } 51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698