OLD | NEW |
1 // -- start List<$E> mixins. | 1 // -- start List<$E> mixins. |
2 // $E is the element type. | 2 // $E is the element type. |
3 | 3 |
4 // From Iterable<$E>: | 4 // From Iterable<$E>: |
5 | 5 |
6 Iterator<$E> iterator() { | 6 Iterator<$E> iterator() { |
7 // Note: NodeLists are not fixed size. And most probably length shouldn't | 7 // Note: NodeLists are not fixed size. And most probably length shouldn't |
8 // be cached in both iterator _and_ forEach method. For now caching it | 8 // be cached in both iterator _and_ forEach method. For now caching it |
9 // for consistency. | 9 // for consistency. |
10 return new FixedSizeListIterator<$E>(this); | 10 return new FixedSizeListIterator<$E>(this); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 Collections.filter(this, <$E>[], f); | 42 Collections.filter(this, <$E>[], f); |
43 | 43 |
44 bool every(bool f($E element)) => Collections.every(this, f); | 44 bool every(bool f($E element)) => Collections.every(this, f); |
45 | 45 |
46 bool some(bool f($E element)) => Collections.some(this, f); | 46 bool some(bool f($E element)) => Collections.some(this, f); |
47 | 47 |
48 bool get isEmpty => this.length == 0; | 48 bool get isEmpty => this.length == 0; |
49 | 49 |
50 // From List<$E>: | 50 // From List<$E>: |
51 | 51 |
52 void sort([Comparator<$E> compare = Comparable.compare]) { | 52 void sort([int compare($E a, $E b)]) { |
53 throw new UnsupportedError("Cannot sort immutable List."); | 53 throw new UnsupportedError("Cannot sort immutable List."); |
54 } | 54 } |
55 | 55 |
56 int indexOf($E element, [int start = 0]) => | 56 int indexOf($E element, [int start = 0]) => |
57 Lists.indexOf(this, element, start, this.length); | 57 Lists.indexOf(this, element, start, this.length); |
58 | 58 |
59 int lastIndexOf($E element, [int start]) { | 59 int lastIndexOf($E element, [int start]) { |
60 if (start == null) start = length - 1; | 60 if (start == null) start = length - 1; |
61 return Lists.lastIndexOf(this, element, start); | 61 return Lists.lastIndexOf(this, element, start); |
62 } | 62 } |
(...skipping 19 matching lines...) Expand all Loading... |
82 } | 82 } |
83 | 83 |
84 void insertRange(int start, int rangeLength, [$E initialValue]) { | 84 void insertRange(int start, int rangeLength, [$E initialValue]) { |
85 throw new UnsupportedError("Cannot insertRange on immutable List."); | 85 throw new UnsupportedError("Cannot insertRange on immutable List."); |
86 } | 86 } |
87 | 87 |
88 List<$E> getRange(int start, int rangeLength) => | 88 List<$E> getRange(int start, int rangeLength) => |
89 Lists.getRange(this, start, rangeLength, <$E>[]); | 89 Lists.getRange(this, start, rangeLength, <$E>[]); |
90 | 90 |
91 // -- end List<$E> mixins. | 91 // -- end List<$E> mixins. |
OLD | NEW |