| 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(length) native "ObjectArray_allocate"; | 9 factory _ObjectArray(length) native "ObjectArray_allocate"; |
| 10 | 10 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 E get single { | 221 E get single { |
| 222 if (length == 1) return this[0]; | 222 if (length == 1) return this[0]; |
| 223 if (length == 0) throw new StateError("No elements"); | 223 if (length == 0) throw new StateError("No elements"); |
| 224 throw new StateError("More than one element"); | 224 throw new StateError("More than one element"); |
| 225 } | 225 } |
| 226 | 226 |
| 227 E min([int compare(E a, E b)]) => IterableMixinWorkaround.min(this, compare); | 227 E min([int compare(E a, E b)]) => IterableMixinWorkaround.min(this, compare); |
| 228 | 228 |
| 229 E max([int compare(E a, E b)]) => IterableMixinWorkaround.max(this, compare); | 229 E max([int compare(E a, E b)]) => IterableMixinWorkaround.max(this, compare); |
| 230 | 230 |
| 231 List<E> toList({ bool growable: false}) { | 231 List<E> toList({ bool growable: true}) { |
| 232 return new List<E>.from(this, growable: growable); | 232 return new List<E>.from(this, growable: growable); |
| 233 } | 233 } |
| 234 | 234 |
| 235 Set<E> toSet() { | 235 Set<E> toSet() { |
| 236 return new Set<E>.from(this); | 236 return new Set<E>.from(this); |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 | 239 |
| 240 | 240 |
| 241 // This is essentially the same class as _ObjectArray, but it does not | 241 // This is essentially the same class as _ObjectArray, but it does not |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 E get single { | 460 E get single { |
| 461 if (length == 1) return this[0]; | 461 if (length == 1) return this[0]; |
| 462 if (length == 0) throw new StateError("No elements"); | 462 if (length == 0) throw new StateError("No elements"); |
| 463 throw new StateError("More than one element"); | 463 throw new StateError("More than one element"); |
| 464 } | 464 } |
| 465 | 465 |
| 466 E min([int compare(E a, E b)]) => IterableMixinWorkaround.min(this, compare); | 466 E min([int compare(E a, E b)]) => IterableMixinWorkaround.min(this, compare); |
| 467 | 467 |
| 468 E max([int compare(E a, E b)]) => IterableMixinWorkaround.max(this, compare); | 468 E max([int compare(E a, E b)]) => IterableMixinWorkaround.max(this, compare); |
| 469 | 469 |
| 470 List<E> toList({ bool growable: false }) { | 470 List<E> toList({ bool growable: true }) { |
| 471 return new List<E>.from(this, growable: growable); | 471 return new List<E>.from(this, growable: growable); |
| 472 } | 472 } |
| 473 | 473 |
| 474 Set<E> toSet() { | 474 Set<E> toSet() { |
| 475 return new Set<E>.from(this); | 475 return new Set<E>.from(this); |
| 476 } | 476 } |
| 477 } | 477 } |
| 478 | 478 |
| 479 | 479 |
| 480 // Iterator for arrays with fixed size. | 480 // Iterator for arrays with fixed size. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 498 } | 498 } |
| 499 _position = _length; | 499 _position = _length; |
| 500 _current = null; | 500 _current = null; |
| 501 return false; | 501 return false; |
| 502 } | 502 } |
| 503 | 503 |
| 504 E get current { | 504 E get current { |
| 505 return _current; | 505 return _current; |
| 506 } | 506 } |
| 507 } | 507 } |
| OLD | NEW |