OLD | NEW |
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; |
| 6 |
5 /** | 7 /** |
6 * An indexed sequence of elements of the same type. | 8 * An indexed sequence of elements of the same type. |
7 * | 9 * |
8 * This is a primitive interface that any finite integer-indexable | 10 * This is a primitive interface that any finite integer-indexable |
9 * sequence can implement. | 11 * sequence can implement. |
10 * It is intended for data structures where access by index is | 12 * It is intended for data structures where access by index is |
11 * the most efficient way to access the data. | 13 * the most efficient way to access the data. |
12 */ | 14 */ |
13 abstract class Sequence<E> { | 15 abstract class Sequence<E> { |
14 /** | 16 /** |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 Sequence<E> _sequence; | 198 Sequence<E> _sequence; |
197 int _position; | 199 int _position; |
198 SequenceIterator(this._sequence) : _position = 0; | 200 SequenceIterator(this._sequence) : _position = 0; |
199 bool get hasNext => _position < _sequence.length; | 201 bool get hasNext => _position < _sequence.length; |
200 E next() { | 202 E next() { |
201 if (hasNext) return _sequence[_position++]; | 203 if (hasNext) return _sequence[_position++]; |
202 throw new StateError("No more elements"); | 204 throw new StateError("No more elements"); |
203 } | 205 } |
204 } | 206 } |
205 | 207 |
OLD | NEW |