| 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 static final int _classId = (new _ObjectArray(0))._cid; | 8 static final int _classId = (new _ObjectArray(0))._cid; |
| 9 | 9 |
| 10 factory _ObjectArray(length) native "ObjectArray_allocate"; | 10 factory _ObjectArray(length) native "ObjectArray_allocate"; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 187 } |
| 188 | 188 |
| 189 E elementAt(int index) { | 189 E elementAt(int index) { |
| 190 return this[index]; | 190 return this[index]; |
| 191 } | 191 } |
| 192 | 192 |
| 193 bool get isEmpty { | 193 bool get isEmpty { |
| 194 return this.length == 0; | 194 return this.length == 0; |
| 195 } | 195 } |
| 196 | 196 |
| 197 bool get isNotEmpty => !isEmpty; |
| 198 |
| 197 Iterable<E> get reversed => IterableMixinWorkaround.reversedList(this); | 199 Iterable<E> get reversed => IterableMixinWorkaround.reversedList(this); |
| 198 | 200 |
| 199 void sort([int compare(E a, E b)]) { | 201 void sort([int compare(E a, E b)]) { |
| 200 IterableMixinWorkaround.sortList(this, compare); | 202 IterableMixinWorkaround.sortList(this, compare); |
| 201 } | 203 } |
| 202 | 204 |
| 203 int indexOf(E element, [int start = 0]) { | 205 int indexOf(E element, [int start = 0]) { |
| 204 return Arrays.indexOf(this, element, start, this.length); | 206 return Arrays.indexOf(this, element, start, this.length); |
| 205 } | 207 } |
| 206 | 208 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 } | 440 } |
| 439 | 441 |
| 440 E elementAt(int index) { | 442 E elementAt(int index) { |
| 441 return this[index]; | 443 return this[index]; |
| 442 } | 444 } |
| 443 | 445 |
| 444 bool get isEmpty { | 446 bool get isEmpty { |
| 445 return this.length == 0; | 447 return this.length == 0; |
| 446 } | 448 } |
| 447 | 449 |
| 450 bool get isNotEmpty => !isEmpty; |
| 451 |
| 448 Iterable<E> get reversed => IterableMixinWorkaround.reversedList(this); | 452 Iterable<E> get reversed => IterableMixinWorkaround.reversedList(this); |
| 449 | 453 |
| 450 void sort([int compare(E a, E b)]) { | 454 void sort([int compare(E a, E b)]) { |
| 451 throw new UnsupportedError( | 455 throw new UnsupportedError( |
| 452 "Cannot modify an immutable array"); | 456 "Cannot modify an immutable array"); |
| 453 } | 457 } |
| 454 | 458 |
| 455 String toString() { | 459 String toString() { |
| 456 return ToString.iterableToString(this); | 460 return ToString.iterableToString(this); |
| 457 } | 461 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 } | 549 } |
| 546 _position = _length; | 550 _position = _length; |
| 547 _current = null; | 551 _current = null; |
| 548 return false; | 552 return false; |
| 549 } | 553 } |
| 550 | 554 |
| 551 E get current { | 555 E get current { |
| 552 return _current; | 556 return _current; |
| 553 } | 557 } |
| 554 } | 558 } |
| OLD | NEW |