| 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 | 5 |
| 6 // TODO(srdjan): Use shared array implementation. | 6 // TODO(srdjan): Use shared array implementation. |
| 7 class _ObjectArray<E> implements List<E> { | 7 class _ObjectArray<E> implements List<E> { |
| 8 | 8 |
| 9 factory _ObjectArray(int length) native "ObjectArray_allocate"; | 9 factory _ObjectArray(int length) native "ObjectArray_allocate"; |
| 10 | 10 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 if (length > 0) return this[length - 1]; | 185 if (length > 0) return this[length - 1]; |
| 186 throw new StateError("No elements"); | 186 throw new StateError("No elements"); |
| 187 } | 187 } |
| 188 | 188 |
| 189 E get single { | 189 E get single { |
| 190 if (length == 1) return this[0]; | 190 if (length == 1) return this[0]; |
| 191 if (length == 0) throw new StateError("No elements"); | 191 if (length == 0) throw new StateError("No elements"); |
| 192 throw new StateError("More than one element"); | 192 throw new StateError("More than one element"); |
| 193 } | 193 } |
| 194 | 194 |
| 195 E min([int compare(E a, E b)]) => Collections.min(this, compare); |
| 196 |
| 197 E max([int compare(E a, E b)]) => Collections.max(this, compare); |
| 198 |
| 195 List<E> toList() { | 199 List<E> toList() { |
| 196 return new List<E>.from(this); | 200 return new List<E>.from(this); |
| 197 } | 201 } |
| 198 | 202 |
| 199 Set<E> toSet() { | 203 Set<E> toSet() { |
| 200 return new Set<E>.from(this); | 204 return new Set<E>.from(this); |
| 201 } | 205 } |
| 202 } | 206 } |
| 203 | 207 |
| 204 | 208 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 } | 431 } |
| 428 _position = _length; | 432 _position = _length; |
| 429 _current = null; | 433 _current = null; |
| 430 return false; | 434 return false; |
| 431 } | 435 } |
| 432 | 436 |
| 433 E get current { | 437 E get current { |
| 434 return _current; | 438 return _current; |
| 435 } | 439 } |
| 436 } | 440 } |
| OLD | NEW |