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 24 matching lines...) Expand all Loading... |
35 Iterable<$E> where(bool f($E element)) => | 35 Iterable<$E> where(bool f($E element)) => |
36 IterableMixinWorkaround.where(this, f); | 36 IterableMixinWorkaround.where(this, f); |
37 | 37 |
38 Iterable expand(Iterable f($E element)) => | 38 Iterable expand(Iterable f($E element)) => |
39 IterableMixinWorkaround.expand(this, f); | 39 IterableMixinWorkaround.expand(this, f); |
40 | 40 |
41 bool every(bool f($E element)) => IterableMixinWorkaround.every(this, f); | 41 bool every(bool f($E element)) => IterableMixinWorkaround.every(this, f); |
42 | 42 |
43 bool any(bool f($E element)) => IterableMixinWorkaround.any(this, f); | 43 bool any(bool f($E element)) => IterableMixinWorkaround.any(this, f); |
44 | 44 |
45 List<$E> toList({ bool growable: false }) => | 45 List<$E> toList({ bool growable: true }) => |
46 new List<$E>.from(this, growable: growable); | 46 new List<$E>.from(this, growable: growable); |
47 | 47 |
48 Set<$E> toSet() => new Set<$E>.from(this); | 48 Set<$E> toSet() => new Set<$E>.from(this); |
49 | 49 |
50 bool get isEmpty => this.length == 0; | 50 bool get isEmpty => this.length == 0; |
51 | 51 |
52 Iterable<$E> take(int n) => IterableMixinWorkaround.takeList(this, n); | 52 Iterable<$E> take(int n) => IterableMixinWorkaround.takeList(this, n); |
53 | 53 |
54 Iterable<$E> takeWhile(bool test($E value)) { | 54 Iterable<$E> takeWhile(bool test($E value)) { |
55 return IterableMixinWorkaround.takeWhile(this, test); | 55 return IterableMixinWorkaround.takeWhile(this, test); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 } | 181 } |
182 | 182 |
183 void insertRange(int start, int rangeLength, [$E initialValue]) { | 183 void insertRange(int start, int rangeLength, [$E initialValue]) { |
184 throw new UnsupportedError("Cannot insertRange on immutable List."); | 184 throw new UnsupportedError("Cannot insertRange on immutable List."); |
185 } | 185 } |
186 | 186 |
187 List<$E> getRange(int start, int rangeLength) => | 187 List<$E> getRange(int start, int rangeLength) => |
188 Lists.getRange(this, start, rangeLength, <$E>[]); | 188 Lists.getRange(this, start, rangeLength, <$E>[]); |
189 | 189 |
190 // -- end List<$E> mixins. | 190 // -- end List<$E> mixins. |
OLD | NEW |