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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 $E elementAt(int index) { | 76 $E elementAt(int index) { |
77 return this[index]; | 77 return this[index]; |
78 } | 78 } |
79 | 79 |
80 // From Collection<$E>: | 80 // From Collection<$E>: |
81 | 81 |
82 void add($E value) { | 82 void add($E value) { |
83 throw new UnsupportedError("Cannot add to immutable List."); | 83 throw new UnsupportedError("Cannot add to immutable List."); |
84 } | 84 } |
85 | 85 |
86 void addLast($E value) { | |
87 throw new UnsupportedError("Cannot add to immutable List."); | |
88 } | |
89 | |
90 void addAll(Iterable<$E> iterable) { | 86 void addAll(Iterable<$E> iterable) { |
91 throw new UnsupportedError("Cannot add to immutable List."); | 87 throw new UnsupportedError("Cannot add to immutable List."); |
92 } | 88 } |
93 | 89 |
94 // From List<$E>: | 90 // From List<$E>: |
95 $if DEFINE_LENGTH_SETTER | 91 $if DEFINE_LENGTH_SETTER |
96 void set length(int value) { | 92 void set length(int value) { |
97 throw new UnsupportedError("Cannot resize immutable List."); | 93 throw new UnsupportedError("Cannot resize immutable List."); |
98 } | 94 } |
99 $endif | 95 $endif |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 return Lists.getRange(this, start, end, <$E>[]); | 189 return Lists.getRange(this, start, end, <$E>[]); |
194 } | 190 } |
195 | 191 |
196 List<$E> getRange(int start, int rangeLength) => | 192 List<$E> getRange(int start, int rangeLength) => |
197 sublist(start, start + rangeLength); | 193 sublist(start, start + rangeLength); |
198 | 194 |
199 Map<int, $E> asMap() => | 195 Map<int, $E> asMap() => |
200 IterableMixinWorkaround.asMapList(this); | 196 IterableMixinWorkaround.asMapList(this); |
201 | 197 |
202 // -- end List<$E> mixins. | 198 // -- end List<$E> mixins. |
OLD | NEW |