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> get iterator { | 6 Iterator<$E> get 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 $endif | 100 $endif |
101 | 101 |
102 $if DEFINE_CLEAR | 102 $if DEFINE_CLEAR |
103 void clear() { | 103 void clear() { |
104 throw new UnsupportedError("Cannot clear immutable List."); | 104 throw new UnsupportedError("Cannot clear immutable List."); |
105 } | 105 } |
106 $else | 106 $else |
107 // clear() defined by IDL. | 107 // clear() defined by IDL. |
108 $endif | 108 $endif |
109 | 109 |
110 List<$E> get reversed { | 110 Iterable<$E> get reversed { |
111 return IterableMixinWorkaround.reversedList(this); | 111 return IterableMixinWorkaround.reversedList(this); |
112 } | 112 } |
113 | 113 |
114 void sort([int compare($E a, $E b)]) { | 114 void sort([int compare($E a, $E b)]) { |
115 throw new UnsupportedError("Cannot sort immutable List."); | 115 throw new UnsupportedError("Cannot sort immutable List."); |
116 } | 116 } |
117 | 117 |
118 int indexOf($E element, [int start = 0]) => | 118 int indexOf($E element, [int start = 0]) => |
119 Lists.indexOf(this, element, start, this.length); | 119 Lists.indexOf(this, element, start, this.length); |
120 | 120 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 182 } |
183 | 183 |
184 void insertRange(int start, int rangeLength, [$E initialValue]) { | 184 void insertRange(int start, int rangeLength, [$E initialValue]) { |
185 throw new UnsupportedError("Cannot insertRange on immutable List."); | 185 throw new UnsupportedError("Cannot insertRange on immutable List."); |
186 } | 186 } |
187 | 187 |
188 List<$E> getRange(int start, int rangeLength) => | 188 List<$E> getRange(int start, int rangeLength) => |
189 Lists.getRange(this, start, rangeLength, <$E>[]); | 189 Lists.getRange(this, start, rangeLength, <$E>[]); |
190 | 190 |
191 // -- end List<$E> mixins. | 191 // -- end List<$E> mixins. |
OLD | NEW |