| 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 /** | 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 void addLast(E value) { | 146 void addLast(E value) { |
| 147 throw new UnsupportedError( | 147 throw new UnsupportedError( |
| 148 "Cannot add to an unmodifiable list"); | 148 "Cannot add to an unmodifiable list"); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void addAll(Collection<E> collection) { | 151 void addAll(Collection<E> collection) { |
| 152 throw new UnsupportedError( | 152 throw new UnsupportedError( |
| 153 "Cannot add to an unmodifiable list"); | 153 "Cannot add to an unmodifiable list"); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void sort([Comparator<E> compare]) { | 156 void sort([int compare(E a, E b)]) { |
| 157 throw new UnsupportedError( | 157 throw new UnsupportedError( |
| 158 "Cannot modify an unmodifiable list"); | 158 "Cannot modify an unmodifiable list"); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void clear() { | 161 void clear() { |
| 162 throw new UnsupportedError( | 162 throw new UnsupportedError( |
| 163 "Cannot clear an unmodifiable list"); | 163 "Cannot clear an unmodifiable list"); |
| 164 } | 164 } |
| 165 | 165 |
| 166 E removeAt(int index) { | 166 E removeAt(int index) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 196 Sequence<E> _sequence; | 196 Sequence<E> _sequence; |
| 197 int _position; | 197 int _position; |
| 198 SequenceIterator(this._sequence) : _position = 0; | 198 SequenceIterator(this._sequence) : _position = 0; |
| 199 bool get hasNext => _position < _sequence.length; | 199 bool get hasNext => _position < _sequence.length; |
| 200 E next() { | 200 E next() { |
| 201 if (hasNext) return _sequence[_position++]; | 201 if (hasNext) return _sequence[_position++]; |
| 202 throw new StateError("No more elements"); | 202 throw new StateError("No more elements"); |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 | 205 |
| OLD | NEW |