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 14 matching lines...) Expand all Loading... |
25 $endif | 25 $endif |
26 | 26 |
27 void forEach(void f($E element)) => IterableMixinWorkaround.forEach(this, f); | 27 void forEach(void f($E element)) => IterableMixinWorkaround.forEach(this, f); |
28 | 28 |
29 String join([String separator]) => | 29 String join([String separator]) => |
30 IterableMixinWorkaround.joinList(this, separator); | 30 IterableMixinWorkaround.joinList(this, separator); |
31 | 31 |
32 Iterable map(f($E element)) => | 32 Iterable map(f($E element)) => |
33 IterableMixinWorkaround.mapList(this, f); | 33 IterableMixinWorkaround.mapList(this, f); |
34 | 34 |
35 List mappedBy(f($E element)) => | |
36 IterableMixinWorkaround.mappedByList(this, f); | |
37 | |
38 Iterable<$E> where(bool f($E element)) => | 35 Iterable<$E> where(bool f($E element)) => |
39 IterableMixinWorkaround.where(this, f); | 36 IterableMixinWorkaround.where(this, f); |
40 | 37 |
41 Iterable expand(Iterable f($E element)) => | 38 Iterable expand(Iterable f($E element)) => |
42 IterableMixinWorkaround.expand(this, f); | 39 IterableMixinWorkaround.expand(this, f); |
43 | 40 |
44 bool every(bool f($E element)) => IterableMixinWorkaround.every(this, f); | 41 bool every(bool f($E element)) => IterableMixinWorkaround.every(this, f); |
45 | 42 |
46 bool any(bool f($E element)) => IterableMixinWorkaround.any(this, f); | 43 bool any(bool f($E element)) => IterableMixinWorkaround.any(this, f); |
47 | 44 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 $endif | 97 $endif |
101 | 98 |
102 $if DEFINE_CLEAR | 99 $if DEFINE_CLEAR |
103 void clear() { | 100 void clear() { |
104 throw new UnsupportedError("Cannot clear immutable List."); | 101 throw new UnsupportedError("Cannot clear immutable List."); |
105 } | 102 } |
106 $else | 103 $else |
107 // clear() defined by IDL. | 104 // clear() defined by IDL. |
108 $endif | 105 $endif |
109 | 106 |
110 List<$E> get reversed { | 107 Iterable<$E> get reversed { |
111 return IterableMixinWorkaround.reversedList(this); | 108 return IterableMixinWorkaround.reversedList(this); |
112 } | 109 } |
113 | 110 |
114 void sort([int compare($E a, $E b)]) { | 111 void sort([int compare($E a, $E b)]) { |
115 throw new UnsupportedError("Cannot sort immutable List."); | 112 throw new UnsupportedError("Cannot sort immutable List."); |
116 } | 113 } |
117 | 114 |
118 int indexOf($E element, [int start = 0]) => | 115 int indexOf($E element, [int start = 0]) => |
119 Lists.indexOf(this, element, start, this.length); | 116 Lists.indexOf(this, element, start, this.length); |
120 | 117 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 179 } |
183 | 180 |
184 void insertRange(int start, int rangeLength, [$E initialValue]) { | 181 void insertRange(int start, int rangeLength, [$E initialValue]) { |
185 throw new UnsupportedError("Cannot insertRange on immutable List."); | 182 throw new UnsupportedError("Cannot insertRange on immutable List."); |
186 } | 183 } |
187 | 184 |
188 List<$E> getRange(int start, int rangeLength) => | 185 List<$E> getRange(int start, int rangeLength) => |
189 Lists.getRange(this, start, rangeLength, <$E>[]); | 186 Lists.getRange(this, start, rangeLength, <$E>[]); |
190 | 187 |
191 // -- end List<$E> mixins. | 188 // -- end List<$E> mixins. |
OLD | NEW |