OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 _interceptors; | 5 part of _interceptors; |
6 | 6 |
7 /** | 7 /** |
8 * The interceptor class for [List]. The compiler recognizes this | 8 * The interceptor class for [List]. The compiler recognizes this |
9 * class as an interceptor, and changes references to [:this:] to | 9 * class as an interceptor, and changes references to [:this:] to |
10 * actually use the receiver of the method, which is generated as an extra | 10 * actually use the receiver of the method, which is generated as an extra |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 throw new RangeError.value(start + length); | 214 throw new RangeError.value(start + length); |
215 } | 215 } |
216 | 216 |
217 Arrays.copy(from, startFrom, this, start, length); | 217 Arrays.copy(from, startFrom, this, start, length); |
218 } | 218 } |
219 | 219 |
220 bool any(bool f(E element)) => IterableMixinWorkaround.any(this, f); | 220 bool any(bool f(E element)) => IterableMixinWorkaround.any(this, f); |
221 | 221 |
222 bool every(bool f(E element)) => IterableMixinWorkaround.every(this, f); | 222 bool every(bool f(E element)) => IterableMixinWorkaround.every(this, f); |
223 | 223 |
| 224 List<E> get reversed => new ReversedList<E>(this, 0, length); |
| 225 |
224 void sort([int compare(E a, E b)]) { | 226 void sort([int compare(E a, E b)]) { |
225 checkMutable(this, 'sort'); | 227 checkMutable(this, 'sort'); |
226 if (compare == null) compare = Comparable.compare; | 228 if (compare == null) compare = Comparable.compare; |
227 coreSort(this, compare); | 229 coreSort(this, compare); |
228 } | 230 } |
229 | 231 |
230 int indexOf(E element, [int start = 0]) { | 232 int indexOf(E element, [int start = 0]) { |
231 if (start is !int) throw new ArgumentError(start); | 233 if (start is !int) throw new ArgumentError(start); |
232 return Arrays.indexOf(this, element, start, length); | 234 return Arrays.indexOf(this, element, start, length); |
233 } | 235 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 if (nextPosition < length) { | 302 if (nextPosition < length) { |
301 _position = nextPosition; | 303 _position = nextPosition; |
302 _current = _list[nextPosition]; | 304 _current = _list[nextPosition]; |
303 return true; | 305 return true; |
304 } | 306 } |
305 _position = length; | 307 _position = length; |
306 _current = null; | 308 _current = null; |
307 return false; | 309 return false; |
308 } | 310 } |
309 } | 311 } |
OLD | NEW |