| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 147 } |
| 148 | 148 |
| 149 E elementAt(int index) { | 149 E elementAt(int index) { |
| 150 return this[index]; | 150 return this[index]; |
| 151 } | 151 } |
| 152 | 152 |
| 153 bool get isEmpty { | 153 bool get isEmpty { |
| 154 return this.length == 0; | 154 return this.length == 0; |
| 155 } | 155 } |
| 156 | 156 |
| 157 List<E> get reversed => new ReversedListView<E>(this, 0, null); |
| 158 |
| 157 void sort([int compare(E a, E b)]) { | 159 void sort([int compare(E a, E b)]) { |
| 158 IterableMixinWorkaround.sortList(this, compare); | 160 IterableMixinWorkaround.sortList(this, compare); |
| 159 } | 161 } |
| 160 | 162 |
| 161 int indexOf(E element, [int start = 0]) { | 163 int indexOf(E element, [int start = 0]) { |
| 162 return Arrays.indexOf(this, element, start, this.length); | 164 return Arrays.indexOf(this, element, start, this.length); |
| 163 } | 165 } |
| 164 | 166 |
| 165 int lastIndexOf(E element, [int start = null]) { | 167 int lastIndexOf(E element, [int start = null]) { |
| 166 if (start == null) start = length - 1; | 168 if (start == null) start = length - 1; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 } | 377 } |
| 376 | 378 |
| 377 E elementAt(int index) { | 379 E elementAt(int index) { |
| 378 return this[index]; | 380 return this[index]; |
| 379 } | 381 } |
| 380 | 382 |
| 381 bool get isEmpty { | 383 bool get isEmpty { |
| 382 return this.length == 0; | 384 return this.length == 0; |
| 383 } | 385 } |
| 384 | 386 |
| 387 List<E> get reversed => new ReversedListView<E>(this, 0, null); |
| 388 |
| 385 void sort([int compare(E a, E b)]) { | 389 void sort([int compare(E a, E b)]) { |
| 386 throw new UnsupportedError( | 390 throw new UnsupportedError( |
| 387 "Cannot modify an immutable array"); | 391 "Cannot modify an immutable array"); |
| 388 } | 392 } |
| 389 | 393 |
| 390 String toString() { | 394 String toString() { |
| 391 return Collections.collectionToString(this); | 395 return Collections.collectionToString(this); |
| 392 } | 396 } |
| 393 | 397 |
| 394 int indexOf(E element, [int start = 0]) { | 398 int indexOf(E element, [int start = 0]) { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 } | 488 } |
| 485 _position = _length; | 489 _position = _length; |
| 486 _current = null; | 490 _current = null; |
| 487 return false; | 491 return false; |
| 488 } | 492 } |
| 489 | 493 |
| 490 E get current { | 494 E get current { |
| 491 return _current; | 495 return _current; |
| 492 } | 496 } |
| 493 } | 497 } |
| OLD | NEW |