| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 /** | 79 /** |
| 80 * Mixin for an unmodifiable [List] class. | 80 * Mixin for an unmodifiable [List] class. |
| 81 * | 81 * |
| 82 * This overrides all mutating methods with methods that throw. | 82 * This overrides all mutating methods with methods that throw. |
| 83 * This mixin is intended to be mixed in on top of [ListMixin] on | 83 * This mixin is intended to be mixed in on top of [ListMixin] on |
| 84 * unmodifiable lists. | 84 * unmodifiable lists. |
| 85 */ | 85 */ |
| 86 abstract class UnmodifiableListMixin<E> { | 86 abstract class UnmodifiableListMixin<E> implements List<E> { |
| 87 | 87 |
| 88 void operator []=(int index, E value) { | 88 void operator []=(int index, E value) { |
| 89 throw new UnsupportedError( | 89 throw new UnsupportedError( |
| 90 "Cannot modify an unmodifiable list"); | 90 "Cannot modify an unmodifiable list"); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void set length(int newLength) { | 93 void set length(int newLength) { |
| 94 throw new UnsupportedError( | 94 throw new UnsupportedError( |
| 95 "Cannot change the length of an unmodifiable list"); | 95 "Cannot change the length of an unmodifiable list"); |
| 96 } | 96 } |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 } | 254 } |
| 255 | 255 |
| 256 class ReversedListIterable<E> extends ListIterable<E> { | 256 class ReversedListIterable<E> extends ListIterable<E> { |
| 257 Iterable<E> _source; | 257 Iterable<E> _source; |
| 258 ReversedListIterable(this._source); | 258 ReversedListIterable(this._source); |
| 259 | 259 |
| 260 int get length => _source.length; | 260 int get length => _source.length; |
| 261 | 261 |
| 262 E elementAt(int index) => _source.elementAt(_source.length - 1 - index); | 262 E elementAt(int index) => _source.elementAt(_source.length - 1 - index); |
| 263 } | 263 } |
| OLD | NEW |