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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 } | 167 } |
168 | 168 |
169 E elementAt(int index) { | 169 E elementAt(int index) { |
170 return this[index]; | 170 return this[index]; |
171 } | 171 } |
172 | 172 |
173 bool get isEmpty { | 173 bool get isEmpty { |
174 return this.length == 0; | 174 return this.length == 0; |
175 } | 175 } |
176 | 176 |
177 Iterable<T> get reversed => IterableMixinWorkaround.reversedList(this); | 177 Iterable<E> get reversed => IterableMixinWorkaround.reversedList(this); |
178 | 178 |
179 void sort([int compare(E a, E b)]) { | 179 void sort([int compare(E a, E b)]) { |
180 IterableMixinWorkaround.sortList(this, compare); | 180 IterableMixinWorkaround.sortList(this, compare); |
181 } | 181 } |
182 | 182 |
183 int indexOf(E element, [int start = 0]) { | 183 int indexOf(E element, [int start = 0]) { |
184 return Arrays.indexOf(this, element, start, this.length); | 184 return Arrays.indexOf(this, element, start, this.length); |
185 } | 185 } |
186 | 186 |
187 int lastIndexOf(E element, [int start = null]) { | 187 int lastIndexOf(E element, [int start = null]) { |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 } | 414 } |
415 | 415 |
416 E elementAt(int index) { | 416 E elementAt(int index) { |
417 return this[index]; | 417 return this[index]; |
418 } | 418 } |
419 | 419 |
420 bool get isEmpty { | 420 bool get isEmpty { |
421 return this.length == 0; | 421 return this.length == 0; |
422 } | 422 } |
423 | 423 |
424 Iterable<T> get reversed => IterableMixinWorkaround.reversedList(this); | 424 Iterable<E> get reversed => IterableMixinWorkaround.reversedList(this); |
425 | 425 |
426 void sort([int compare(E a, E b)]) { | 426 void sort([int compare(E a, E b)]) { |
427 throw new UnsupportedError( | 427 throw new UnsupportedError( |
428 "Cannot modify an immutable array"); | 428 "Cannot modify an immutable array"); |
429 } | 429 } |
430 | 430 |
431 String toString() { | 431 String toString() { |
432 return Collections.collectionToString(this); | 432 return Collections.collectionToString(this); |
433 } | 433 } |
434 | 434 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 } | 525 } |
526 _position = _length; | 526 _position = _length; |
527 _current = null; | 527 _current = null; |
528 return false; | 528 return false; |
529 } | 529 } |
530 | 530 |
531 E get current { | 531 E get current { |
532 return _current; | 532 return _current; |
533 } | 533 } |
534 } | 534 } |
OLD | NEW |