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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } | 160 } |
161 | 161 |
162 void retainWhere(bool test($E element)) { | 162 void retainWhere(bool test($E element)) { |
163 throw new UnsupportedError("Cannot remove from immutable List."); | 163 throw new UnsupportedError("Cannot remove from immutable List."); |
164 } | 164 } |
165 | 165 |
166 void setRange(int start, int end, Iterable<$E> iterable, [int skipCount]) { | 166 void setRange(int start, int end, Iterable<$E> iterable, [int skipCount]) { |
167 throw new UnsupportedError("Cannot setRange on immutable List."); | 167 throw new UnsupportedError("Cannot setRange on immutable List."); |
168 } | 168 } |
169 | 169 |
170 void removeRange(int start, int rangeLength) { | 170 void removeRange(int start, int end) { |
171 throw new UnsupportedError("Cannot removeRange on immutable List."); | 171 throw new UnsupportedError("Cannot removeRange on immutable List."); |
172 } | 172 } |
173 | 173 |
174 void insertRange(int start, int rangeLength, [$E initialValue]) { | |
175 throw new UnsupportedError("Cannot insertRange on immutable List."); | |
176 } | |
177 | |
178 Iterable<$E> getRange(int start, int end) => | 174 Iterable<$E> getRange(int start, int end) => |
179 IterableMixinWorkaround.getRangeList(this, start, end); | 175 IterableMixinWorkaround.getRangeList(this, start, end); |
180 | 176 |
181 List<$E> sublist(int start, [int end]) { | 177 List<$E> sublist(int start, [int end]) { |
182 if (end == null) end = length; | 178 if (end == null) end = length; |
183 return Lists.getRange(this, start, end, <$E>[]); | 179 return Lists.getRange(this, start, end, <$E>[]); |
184 } | 180 } |
185 | 181 |
186 Map<int, $E> asMap() => | 182 Map<int, $E> asMap() => |
187 IterableMixinWorkaround.asMapList(this); | 183 IterableMixinWorkaround.asMapList(this); |
188 | 184 |
189 String toString() { | 185 String toString() { |
190 StringBuffer buffer = new StringBuffer('['); | 186 StringBuffer buffer = new StringBuffer('['); |
191 buffer.writeAll(this, ', '); | 187 buffer.writeAll(this, ', '); |
192 buffer.write(']'); | 188 buffer.write(']'); |
193 return buffer.toString(); | 189 return buffer.toString(); |
194 } | 190 } |
195 | 191 |
196 // -- end List<$E> mixins. | 192 // -- end List<$E> mixins. |
OLD | NEW |