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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 E removeAt(int index) { | 63 E removeAt(int index) { |
64 throw new UnsupportedError( | 64 throw new UnsupportedError( |
65 "Cannot remove from a fixed-length list"); | 65 "Cannot remove from a fixed-length list"); |
66 } | 66 } |
67 | 67 |
68 E removeLast() { | 68 E removeLast() { |
69 throw new UnsupportedError( | 69 throw new UnsupportedError( |
70 "Cannot remove from a fixed-length list"); | 70 "Cannot remove from a fixed-length list"); |
71 } | 71 } |
72 | 72 |
73 void removeRange(int start, int length) { | 73 void removeRange(int start, int end) { |
74 throw new UnsupportedError( | 74 throw new UnsupportedError( |
75 "Cannot remove from a fixed-length list"); | 75 "Cannot remove from a fixed-length list"); |
76 } | 76 } |
77 | 77 |
78 void insertRange(int start, int length, [E initialValue]) { | 78 void insertRange(int start, int length, [E initialValue]) { |
79 throw new UnsupportedError( | 79 throw new UnsupportedError( |
80 "Cannot insert range in a fixed-length list"); | 80 "Cannot insert range in a fixed-length list"); |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 E removeLast() { | 158 E removeLast() { |
159 throw new UnsupportedError( | 159 throw new UnsupportedError( |
160 "Cannot remove from an unmodifiable list"); | 160 "Cannot remove from an unmodifiable list"); |
161 } | 161 } |
162 | 162 |
163 void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) { | 163 void setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) { |
164 throw new UnsupportedError( | 164 throw new UnsupportedError( |
165 "Cannot modify an unmodifiable list"); | 165 "Cannot modify an unmodifiable list"); |
166 } | 166 } |
167 | 167 |
168 void removeRange(int start, int length) { | 168 void removeRange(int start, int end) { |
169 throw new UnsupportedError( | 169 throw new UnsupportedError( |
170 "Cannot remove from an unmodifiable list"); | 170 "Cannot remove from an unmodifiable list"); |
171 } | 171 } |
172 | 172 |
173 void insertRange(int start, int length, [E initialValue]) { | 173 void insertRange(int start, int length, [E initialValue]) { |
174 throw new UnsupportedError( | 174 throw new UnsupportedError( |
175 "Cannot insert range in an unmodifiable list"); | 175 "Cannot insert range in an unmodifiable list"); |
176 } | 176 } |
177 } | 177 } |
178 | 178 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } | 249 } |
250 | 250 |
251 class ReversedListIterable<E> extends ListIterable<E> { | 251 class ReversedListIterable<E> extends ListIterable<E> { |
252 Iterable<E> _source; | 252 Iterable<E> _source; |
253 ReversedListIterable(this._source); | 253 ReversedListIterable(this._source); |
254 | 254 |
255 int get length => _source.length; | 255 int get length => _source.length; |
256 | 256 |
257 E elementAt(int index) => _source.elementAt(_source.length - 1 - index); | 257 E elementAt(int index) => _source.elementAt(_source.length - 1 - index); |
258 } | 258 } |
OLD | NEW |