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 11 matching lines...) Expand all Loading... |
22 bool contains($E element) => IterableMixinWorkaround.contains(this, element); | 22 bool contains($E element) => IterableMixinWorkaround.contains(this, element); |
23 $else | 23 $else |
24 // contains() defined by IDL. | 24 // contains() defined by IDL. |
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 List mappedBy(f($E element)) => IterableMixinWorkaround.mappedByList(this, f); | 32 Iterable map(f($E element)) => |
| 33 IterableMixinWorkaround.map(this, f); |
| 34 |
| 35 List mappedBy(f($E element)) => |
| 36 IterableMixinWorkaround.mappedByList(this, f); |
33 | 37 |
34 Iterable<$E> where(bool f($E element)) => | 38 Iterable<$E> where(bool f($E element)) => |
35 IterableMixinWorkaround.where(this, f); | 39 IterableMixinWorkaround.where(this, f); |
36 | 40 |
37 bool every(bool f($E element)) => IterableMixinWorkaround.every(this, f); | 41 bool every(bool f($E element)) => IterableMixinWorkaround.every(this, f); |
38 | 42 |
39 bool any(bool f($E element)) => IterableMixinWorkaround.any(this, f); | 43 bool any(bool f($E element)) => IterableMixinWorkaround.any(this, f); |
40 | 44 |
41 List<$E> toList() => new List<$E>.from(this); | 45 List<$E> toList() => new List<$E>.from(this); |
42 Set<$E> toSet() => new Set<$E>.from(this); | 46 Set<$E> toSet() => new Set<$E>.from(this); |
43 | 47 |
44 bool get isEmpty => this.length == 0; | 48 bool get isEmpty => this.length == 0; |
45 | 49 |
46 List<$E> take(int n) => IterableMixinWorkaround.takeList(this, n); | 50 Iterable<$E> take(int n) => IterableMixinWorkaround.takeList(this, n); |
47 | 51 |
48 Iterable<$E> takeWhile(bool test($E value)) { | 52 Iterable<$E> takeWhile(bool test($E value)) { |
49 return IterableMixinWorkaround.takeWhile(this, test); | 53 return IterableMixinWorkaround.takeWhile(this, test); |
50 } | 54 } |
51 | 55 |
52 List<$E> skip(int n) => IterableMixinWorkaround.skipList(this, n); | 56 Iterable<$E> skip(int n) => IterableMixinWorkaround.skipList(this, n); |
53 | 57 |
54 Iterable<$E> skipWhile(bool test($E value)) { | 58 Iterable<$E> skipWhile(bool test($E value)) { |
55 return IterableMixinWorkaround.skipWhile(this, test); | 59 return IterableMixinWorkaround.skipWhile(this, test); |
56 } | 60 } |
57 | 61 |
58 $E firstMatching(bool test($E value), { $E orElse() }) { | 62 $E firstMatching(bool test($E value), { $E orElse() }) { |
59 return IterableMixinWorkaround.firstMatching(this, test, orElse); | 63 return IterableMixinWorkaround.firstMatching(this, test, orElse); |
60 } | 64 } |
61 | 65 |
62 $E lastMatching(bool test($E value), {$E orElse()}) { | 66 $E lastMatching(bool test($E value), {$E orElse()}) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 179 } |
176 | 180 |
177 void insertRange(int start, int rangeLength, [$E initialValue]) { | 181 void insertRange(int start, int rangeLength, [$E initialValue]) { |
178 throw new UnsupportedError("Cannot insertRange on immutable List."); | 182 throw new UnsupportedError("Cannot insertRange on immutable List."); |
179 } | 183 } |
180 | 184 |
181 List<$E> getRange(int start, int rangeLength) => | 185 List<$E> getRange(int start, int rangeLength) => |
182 Lists.getRange(this, start, rangeLength, <$E>[]); | 186 Lists.getRange(this, start, rangeLength, <$E>[]); |
183 | 187 |
184 // -- end List<$E> mixins. | 188 // -- end List<$E> mixins. |
OLD | NEW |