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 _List<E> implements List<E> { | 7 class _List<E> implements List<E> { |
8 static final int _classId = (new _List(0))._cid; | 8 static final int _classId = (new _List(0))._cid; |
9 | 9 |
10 factory _List(length) native "List_allocate"; | 10 factory _List(length) native "List_allocate"; |
11 | 11 |
12 E operator [](int index) native "List_getIndexed"; | 12 E operator [](int index) native "List_getIndexed"; |
13 | 13 |
14 void operator []=(int index, E value) native "List_setIndexed"; | 14 void operator []=(int index, E value) native "List_setIndexed"; |
15 | 15 |
16 String toString() { | 16 String toString() { |
17 return IterableMixinWorkaround.toStringIterable(this,'[' , ']'); | 17 return ListBase.listToString(this); |
18 } | 18 } |
19 | 19 |
20 int get length native "List_getLength"; | 20 int get length native "List_getLength"; |
21 | 21 |
22 void _copyFromObjectArray(_List src, | 22 void _copyFromObjectArray(_List src, |
23 int srcStart, | 23 int srcStart, |
24 int dstStart, | 24 int dstStart, |
25 int count) | 25 int count) |
26 native "List_copyFromObjectArray"; | 26 native "List_copyFromObjectArray"; |
27 | 27 |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 436 |
437 void sort([int compare(E a, E b)]) { | 437 void sort([int compare(E a, E b)]) { |
438 throw UnmodifiableListError.change(); | 438 throw UnmodifiableListError.change(); |
439 } | 439 } |
440 | 440 |
441 void shuffle([Random random]) { | 441 void shuffle([Random random]) { |
442 throw UnmodifiableListError.change(); | 442 throw UnmodifiableListError.change(); |
443 } | 443 } |
444 | 444 |
445 String toString() { | 445 String toString() { |
446 return IterableMixinWorkaround.toStringIterable(this, '[', ']'); | 446 return ListBase.listToString(this); |
447 } | 447 } |
448 | 448 |
449 int indexOf(Object element, [int start = 0]) { | 449 int indexOf(Object element, [int start = 0]) { |
450 return Lists.indexOf(this, element, start, this.length); | 450 return Lists.indexOf(this, element, start, this.length); |
451 } | 451 } |
452 | 452 |
453 int lastIndexOf(Object element, [int start = null]) { | 453 int lastIndexOf(Object element, [int start = null]) { |
454 if (start == null) start = length - 1; | 454 if (start == null) start = length - 1; |
455 return Lists.lastIndexOf(this, element, start); | 455 return Lists.lastIndexOf(this, element, start); |
456 } | 456 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 } | 530 } |
531 _position = _length; | 531 _position = _length; |
532 _current = null; | 532 _current = null; |
533 return false; | 533 return false; |
534 } | 534 } |
535 | 535 |
536 E get current { | 536 E get current { |
537 return _current; | 537 return _current; |
538 } | 538 } |
539 } | 539 } |
OLD | NEW |