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() { | 143 void shuffle([Random random]) { |
144 throw new UnsupportedError( | 144 throw new UnsupportedError( |
145 "Cannot modify an unmodifiable list"); | 145 "Cannot modify an unmodifiable list"); |
146 } | 146 } |
147 | 147 |
148 void clear() { | 148 void clear() { |
149 throw new UnsupportedError( | 149 throw new UnsupportedError( |
150 "Cannot clear an unmodifiable list"); | 150 "Cannot clear an unmodifiable list"); |
151 } | 151 } |
152 | 152 |
153 E removeAt(int index) { | 153 E removeAt(int index) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 } | 259 } |
260 | 260 |
261 class ReversedListIterable<E> extends ListIterable<E> { | 261 class ReversedListIterable<E> extends ListIterable<E> { |
262 Iterable<E> _source; | 262 Iterable<E> _source; |
263 ReversedListIterable(this._source); | 263 ReversedListIterable(this._source); |
264 | 264 |
265 int get length => _source.length; | 265 int get length => _source.length; |
266 | 266 |
267 E elementAt(int index) => _source.elementAt(_source.length - 1 - index); | 267 E elementAt(int index) => _source.elementAt(_source.length - 1 - index); |
268 } | 268 } |
OLD | NEW |