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