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

Side by Side Diff: lib/core/sequences.dart

Issue 11230011: Make hasNext a getter instead of a method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove unused variable. Created 8 years, 2 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
« no previous file with comments | « lib/core/iterator.dart ('k') | lib/coreimpl/collections.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /** 5 /**
6 * An indexed sequence of elements of the same type. 6 * An indexed sequence of elements of the same type.
7 * 7 *
8 * This is a primitive interface that any finite integer-indexable 8 * This is a primitive interface that any finite integer-indexable
9 * sequence can implement. 9 * sequence can implement.
10 * It is intended for data structures where access by index is 10 * It is intended for data structures where access by index is
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 188 }
189 } 189 }
190 190
191 /** 191 /**
192 * Iterates over a [Sequence] in growing index order. 192 * Iterates over a [Sequence] in growing index order.
193 */ 193 */
194 class SequenceIterator<E> implements Iterator<E> { 194 class SequenceIterator<E> implements Iterator<E> {
195 Sequence<E> _sequence; 195 Sequence<E> _sequence;
196 int _position; 196 int _position;
197 SequenceIterator(this._sequence) : _position = 0; 197 SequenceIterator(this._sequence) : _position = 0;
198 bool hasNext() => _position < _sequence.length; 198 bool get hasNext => _position < _sequence.length;
199 E next() { 199 E next() {
200 if (hasNext()) return _sequence[_position++]; 200 if (hasNext) return _sequence[_position++];
201 throw new NoMoreElementsException(); 201 throw new NoMoreElementsException();
202 } 202 }
203 } 203 }
204 204
OLDNEW
« no previous file with comments | « lib/core/iterator.dart ('k') | lib/coreimpl/collections.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698