| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 } | 176 } |
| 177 | 177 |
| 178 void removeRange(int start, int rangeLength) { | 178 void removeRange(int start, int rangeLength) { |
| 179 throw new UnsupportedError("Cannot removeRange on immutable List."); | 179 throw new UnsupportedError("Cannot removeRange on immutable List."); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void insertRange(int start, int rangeLength, [$E initialValue]) { | 182 void insertRange(int start, int rangeLength, [$E initialValue]) { |
| 183 throw new UnsupportedError("Cannot insertRange on immutable List."); | 183 throw new UnsupportedError("Cannot insertRange on immutable List."); |
| 184 } | 184 } |
| 185 | 185 |
| 186 Iterable<$E> getRange(int start, int end) => |
| 187 IterableMixinWorkaround.getRangeList(this, start, end); |
| 188 |
| 186 List<$E> sublist(int start, [int end]) { | 189 List<$E> sublist(int start, [int end]) { |
| 187 if (end == null) end = length; | 190 if (end == null) end = length; |
| 188 return Lists.getRange(this, start, end, <$E>[]); | 191 return Lists.getRange(this, start, end, <$E>[]); |
| 189 } | 192 } |
| 190 | 193 |
| 191 List<$E> getRange(int start, int rangeLength) => | |
| 192 sublist(start, start + rangeLength); | |
| 193 | |
| 194 Map<int, $E> asMap() => | 194 Map<int, $E> asMap() => |
| 195 IterableMixinWorkaround.asMapList(this); | 195 IterableMixinWorkaround.asMapList(this); |
| 196 | 196 |
| 197 String toString() { | 197 String toString() { |
| 198 StringBuffer buffer = new StringBuffer('['); | 198 StringBuffer buffer = new StringBuffer('['); |
| 199 buffer.writeAll(this, ', '); | 199 buffer.writeAll(this, ', '); |
| 200 buffer.write(']'); | 200 buffer.write(']'); |
| 201 return buffer.toString(); | 201 return buffer.toString(); |
| 202 } | 202 } |
| 203 | 203 |
| 204 // -- end List<$E> mixins. | 204 // -- end List<$E> mixins. |
| OLD | NEW |