| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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._collection.dev; | 5 part of dart._collection.dev; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Mixin that throws on the length changing operations of [List]. | 8 * Mixin that throws on the length changing operations of [List]. |
| 9 * | 9 * |
| 10 * Intended to mix-in on top of [ListMixin] for fixed-length lists. | 10 * Intended to mix-in on top of [ListMixin] for fixed-length lists. |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 "Cannot modify an unmodifiable list"); | 180 "Cannot modify an unmodifiable list"); |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 | 183 |
| 184 /** | 184 /** |
| 185 * Abstract implementation of a fixed-length list. | 185 * Abstract implementation of a fixed-length list. |
| 186 * | 186 * |
| 187 * All operations are defined in terms of `length`, `operator[]` and | 187 * All operations are defined in terms of `length`, `operator[]` and |
| 188 * `operator[]=`, which need to be implemented. | 188 * `operator[]=`, which need to be implemented. |
| 189 */ | 189 */ |
| 190 typedef FixedLengthListBase<E> = ListBase<E> with FixedLengthListMixin<E>; | 190 abstract class FixedLengthListBase<E> = |
| 191 ListBase<E> with FixedLengthListMixin<E>; |
| 191 | 192 |
| 192 /** | 193 /** |
| 193 * Abstract implementation of an unmodifiable list. | 194 * Abstract implementation of an unmodifiable list. |
| 194 * | 195 * |
| 195 * All operations are defined in terms of `length` and `operator[]`, | 196 * All operations are defined in terms of `length` and `operator[]`, |
| 196 * which need to be implemented. | 197 * which need to be implemented. |
| 197 */ | 198 */ |
| 198 typedef UnmodifiableListBase<E> = ListBase<E> with UnmodifiableListMixin<E>; | 199 abstract class UnmodifiableListBase<E> = |
| 200 ListBase<E> with UnmodifiableListMixin<E>; |
| 199 | 201 |
| 200 class _ListIndicesIterable extends ListIterable<int> { | 202 class _ListIndicesIterable extends ListIterable<int> { |
| 201 List _backedList; | 203 List _backedList; |
| 202 | 204 |
| 203 _ListIndicesIterable(this._backedList); | 205 _ListIndicesIterable(this._backedList); |
| 204 | 206 |
| 205 int get length => _backedList.length; | 207 int get length => _backedList.length; |
| 206 int elementAt(int index) { | 208 int elementAt(int index) { |
| 207 if (index < 0 || index >= length) { | 209 if (index < 0 || index >= length) { |
| 208 throw new RangeError.range(index, 0, length); | 210 throw new RangeError.range(index, 0, length); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 } | 261 } |
| 260 | 262 |
| 261 class ReversedListIterable<E> extends ListIterable<E> { | 263 class ReversedListIterable<E> extends ListIterable<E> { |
| 262 Iterable<E> _source; | 264 Iterable<E> _source; |
| 263 ReversedListIterable(this._source); | 265 ReversedListIterable(this._source); |
| 264 | 266 |
| 265 int get length => _source.length; | 267 int get length => _source.length; |
| 266 | 268 |
| 267 E elementAt(int index) => _source.elementAt(_source.length - 1 - index); | 269 E elementAt(int index) => _source.elementAt(_source.length - 1 - index); |
| 268 } | 270 } |
| OLD | NEW |