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() => ListBase.listToString(this); |
floitsch
2014/05/23 16:09:58
runtime/lib files preferred to avoid the "=>" synt
Lasse Reichstein Nielsen
2014/05/23 16:50:01
I have no problem using brackets instead.
| |
17 return IterableMixinWorkaround.toStringIterable(this,'[' , ']'); | |
18 } | |
19 | 17 |
20 int get length native "List_getLength"; | 18 int get length native "List_getLength"; |
21 | 19 |
22 void _copyFromObjectArray(_List src, | 20 void _copyFromObjectArray(_List src, |
23 int srcStart, | 21 int srcStart, |
24 int dstStart, | 22 int dstStart, |
25 int count) | 23 int count) |
26 native "List_copyFromObjectArray"; | 24 native "List_copyFromObjectArray"; |
27 | 25 |
28 void insert(int index, E element) { | 26 void insert(int index, E element) { |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
435 Iterable<E> get reversed => IterableMixinWorkaround.reversedList(this); | 433 Iterable<E> get reversed => IterableMixinWorkaround.reversedList(this); |
436 | 434 |
437 void sort([int compare(E a, E b)]) { | 435 void sort([int compare(E a, E b)]) { |
438 throw UnmodifiableListError.change(); | 436 throw UnmodifiableListError.change(); |
439 } | 437 } |
440 | 438 |
441 void shuffle([Random random]) { | 439 void shuffle([Random random]) { |
442 throw UnmodifiableListError.change(); | 440 throw UnmodifiableListError.change(); |
443 } | 441 } |
444 | 442 |
445 String toString() { | 443 String toString() => ListBase.listToString(this); |
446 return IterableMixinWorkaround.toStringIterable(this, '[', ']'); | |
447 } | |
448 | 444 |
449 int indexOf(Object element, [int start = 0]) { | 445 int indexOf(Object element, [int start = 0]) { |
450 return Lists.indexOf(this, element, start, this.length); | 446 return Lists.indexOf(this, element, start, this.length); |
451 } | 447 } |
452 | 448 |
453 int lastIndexOf(Object element, [int start = null]) { | 449 int lastIndexOf(Object element, [int start = null]) { |
454 if (start == null) start = length - 1; | 450 if (start == null) start = length - 1; |
455 return Lists.lastIndexOf(this, element, start); | 451 return Lists.lastIndexOf(this, element, start); |
456 } | 452 } |
457 | 453 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
530 } | 526 } |
531 _position = _length; | 527 _position = _length; |
532 _current = null; | 528 _current = null; |
533 return false; | 529 return false; |
534 } | 530 } |
535 | 531 |
536 E get current { | 532 E get current { |
537 return _current; | 533 return _current; |
538 } | 534 } |
539 } | 535 } |
OLD | NEW |