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