| 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"; |
| 11 | 11 |
| 12 E operator [](int index) native "ObjectArray_getIndexed"; | 12 E operator [](int index) native "ObjectArray_getIndexed"; |
| 13 | 13 |
| 14 void operator []=(int index, E value) native "ObjectArray_setIndexed"; | 14 void operator []=(int index, E value) native "ObjectArray_setIndexed"; |
| 15 | 15 |
| 16 String toString() { | 16 String toString() { |
| 17 return IterableMixinWorkaround.toStringIterable(this,'[' , ']'); | 17 return ToString.iterableToString(this); |
| 18 } | 18 } |
| 19 | 19 |
| 20 int get length native "ObjectArray_getLength"; | 20 int get length native "ObjectArray_getLength"; |
| 21 | 21 |
| 22 void _copyFromObjectArray(_ObjectArray src, | 22 void _copyFromObjectArray(_ObjectArray src, |
| 23 int srcStart, | 23 int srcStart, |
| 24 int dstStart, | 24 int dstStart, |
| 25 int count) | 25 int count) |
| 26 native "ObjectArray_copyFromObjectArray"; | 26 native "ObjectArray_copyFromObjectArray"; |
| 27 | 27 |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 bool get isNotEmpty => !isEmpty; | 450 bool get isNotEmpty => !isEmpty; |
| 451 | 451 |
| 452 Iterable<E> get reversed => IterableMixinWorkaround.reversedList(this); | 452 Iterable<E> get reversed => IterableMixinWorkaround.reversedList(this); |
| 453 | 453 |
| 454 void sort([int compare(E a, E b)]) { | 454 void sort([int compare(E a, E b)]) { |
| 455 throw new UnsupportedError( | 455 throw new UnsupportedError( |
| 456 "Cannot modify an immutable array"); | 456 "Cannot modify an immutable array"); |
| 457 } | 457 } |
| 458 | 458 |
| 459 String toString() { | 459 String toString() { |
| 460 return IterableMixinWorkaround.toStringIterable(this, '[', ']'); | 460 return ToString.iterableToString(this); |
| 461 } | 461 } |
| 462 | 462 |
| 463 int indexOf(Object element, [int start = 0]) { | 463 int indexOf(Object element, [int start = 0]) { |
| 464 return Arrays.indexOf(this, element, start, this.length); | 464 return Arrays.indexOf(this, element, start, this.length); |
| 465 } | 465 } |
| 466 | 466 |
| 467 int lastIndexOf(Object element, [int start = null]) { | 467 int lastIndexOf(Object element, [int start = null]) { |
| 468 if (start == null) start = length - 1; | 468 if (start == null) start = length - 1; |
| 469 return Arrays.lastIndexOf(this, element, start); | 469 return Arrays.lastIndexOf(this, element, start); |
| 470 } | 470 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 } | 549 } |
| 550 _position = _length; | 550 _position = _length; |
| 551 _current = null; | 551 _current = null; |
| 552 return false; | 552 return false; |
| 553 } | 553 } |
| 554 | 554 |
| 555 E get current { | 555 E get current { |
| 556 return _current; | 556 return _current; |
| 557 } | 557 } |
| 558 } | 558 } |
| OLD | NEW |