Chromium Code Reviews| 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() => new List<$E>.from(this); | 45 List<$E> toList({ bool growable: false }) => |
| 46 new List<$E>.from(this, growable: growable); | |
|
floitsch
2013/02/26 13:54:19
IterableMixinWorkaround.
| |
| 47 | |
| 46 Set<$E> toSet() => new Set<$E>.from(this); | 48 Set<$E> toSet() => new Set<$E>.from(this); |
| 47 | 49 |
| 48 bool get isEmpty => this.length == 0; | 50 bool get isEmpty => this.length == 0; |
| 49 | 51 |
| 50 Iterable<$E> take(int n) => IterableMixinWorkaround.takeList(this, n); | 52 Iterable<$E> take(int n) => IterableMixinWorkaround.takeList(this, n); |
| 51 | 53 |
| 52 Iterable<$E> takeWhile(bool test($E value)) { | 54 Iterable<$E> takeWhile(bool test($E value)) { |
| 53 return IterableMixinWorkaround.takeWhile(this, test); | 55 return IterableMixinWorkaround.takeWhile(this, test); |
| 54 } | 56 } |
| 55 | 57 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 } | 181 } |
| 180 | 182 |
| 181 void insertRange(int start, int rangeLength, [$E initialValue]) { | 183 void insertRange(int start, int rangeLength, [$E initialValue]) { |
| 182 throw new UnsupportedError("Cannot insertRange on immutable List."); | 184 throw new UnsupportedError("Cannot insertRange on immutable List."); |
| 183 } | 185 } |
| 184 | 186 |
| 185 List<$E> getRange(int start, int rangeLength) => | 187 List<$E> getRange(int start, int rangeLength) => |
| 186 Lists.getRange(this, start, rangeLength, <$E>[]); | 188 Lists.getRange(this, start, rangeLength, <$E>[]); |
| 187 | 189 |
| 188 // -- end List<$E> mixins. | 190 // -- end List<$E> mixins. |
| OLD | NEW |