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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 void retainWhere(bool test(E element)) { | 133 void retainWhere(bool test(E element)) { |
134 throw new UnsupportedError( | 134 throw new UnsupportedError( |
135 "Cannot remove from an unmodifiable list"); | 135 "Cannot remove from an unmodifiable list"); |
136 } | 136 } |
137 | 137 |
138 void sort([Comparator<E> compare]) { | 138 void sort([Comparator<E> compare]) { |
139 throw new UnsupportedError( | 139 throw new UnsupportedError( |
140 "Cannot modify an unmodifiable list"); | 140 "Cannot modify an unmodifiable list"); |
141 } | 141 } |
142 | 142 |
| 143 void shuffle() { |
| 144 throw new UnsupportedError( |
| 145 "Cannot modify an unmodifiable list"); |
| 146 } |
| 147 |
143 void clear() { | 148 void clear() { |
144 throw new UnsupportedError( | 149 throw new UnsupportedError( |
145 "Cannot clear an unmodifiable list"); | 150 "Cannot clear an unmodifiable list"); |
146 } | 151 } |
147 | 152 |
148 E removeAt(int index) { | 153 E removeAt(int index) { |
149 throw new UnsupportedError( | 154 throw new UnsupportedError( |
150 "Cannot remove from an unmodifiable list"); | 155 "Cannot remove from an unmodifiable list"); |
151 } | 156 } |
152 | 157 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 } | 259 } |
255 | 260 |
256 class ReversedListIterable<E> extends ListIterable<E> { | 261 class ReversedListIterable<E> extends ListIterable<E> { |
257 Iterable<E> _source; | 262 Iterable<E> _source; |
258 ReversedListIterable(this._source); | 263 ReversedListIterable(this._source); |
259 | 264 |
260 int get length => _source.length; | 265 int get length => _source.length; |
261 | 266 |
262 E elementAt(int index) => _source.elementAt(_source.length - 1 - index); | 267 E elementAt(int index) => _source.elementAt(_source.length - 1 - index); |
263 } | 268 } |
OLD | NEW |