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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 if (length == 0) throw new StateError("No elements"); | 137 if (length == 0) throw new StateError("No elements"); |
138 throw new StateError("More than one element"); | 138 throw new StateError("More than one element"); |
139 } | 139 } |
140 | 140 |
141 $E min([int compare($E a, $E b)]) => | 141 $E min([int compare($E a, $E b)]) => |
142 IterableMixinWorkaround.min(this, compare); | 142 IterableMixinWorkaround.min(this, compare); |
143 | 143 |
144 $E max([int compare($E a, $E b)]) => | 144 $E max([int compare($E a, $E b)]) => |
145 IterableMixinWorkaround.max(this, compare); | 145 IterableMixinWorkaround.max(this, compare); |
146 | 146 |
| 147 void insert(int index, $E element) { |
| 148 throw new UnsupportedError("Cannot add to immutable List."); |
| 149 } |
| 150 |
147 $E removeAt(int pos) { | 151 $E removeAt(int pos) { |
148 throw new UnsupportedError("Cannot remove from immutable List."); | 152 throw new UnsupportedError("Cannot remove from immutable List."); |
149 } | 153 } |
150 | 154 |
151 $E removeLast() { | 155 $E removeLast() { |
152 throw new UnsupportedError("Cannot remove from immutable List."); | 156 throw new UnsupportedError("Cannot remove from immutable List."); |
153 } | 157 } |
154 | 158 |
155 void remove(Object object) { | 159 void remove(Object object) { |
156 throw new UnsupportedError("Cannot remove from immutable List."); | 160 throw new UnsupportedError("Cannot remove from immutable List."); |
(...skipping 27 matching lines...) Expand all Loading... |
184 throw new UnsupportedError("Cannot insertRange on immutable List."); | 188 throw new UnsupportedError("Cannot insertRange on immutable List."); |
185 } | 189 } |
186 | 190 |
187 List<$E> getRange(int start, int rangeLength) => | 191 List<$E> getRange(int start, int rangeLength) => |
188 Lists.getRange(this, start, rangeLength, <$E>[]); | 192 Lists.getRange(this, start, rangeLength, <$E>[]); |
189 | 193 |
190 Map<int, $E> asMap() => | 194 Map<int, $E> asMap() => |
191 IterableMixinWorkaround.asMapList(this); | 195 IterableMixinWorkaround.asMapList(this); |
192 | 196 |
193 // -- end List<$E> mixins. | 197 // -- end List<$E> mixins. |
OLD | NEW |