| // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| // Iterator for arrays with fixed size. |
| class FixedSizeListIterator<T> implements Iterator<T> { |
| final int _length; // Cache array length for faster access. |
| FixedSizeListIterator(List<T> array) |
| int nextPosition = _position + 1; |
| if (nextPosition < _length) { |
| _current = _array[nextPosition]; |
| _position = nextPosition; |
| T get current => _current; |
| // Iterator for arrays with variable size. |
| class _VariableSizeListIterator<T> implements Iterator<T> { |
| _VariableSizeListIterator(List<T> array) |
| int nextPosition = _position + 1; |
| if (nextPosition < _array.length) { |
| _current = _array[nextPosition]; |
| _position = nextPosition; |
| _position = _array.length; |
| T get current => _current; |