| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of html_common; | 5 part of html_common; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * An indexable collection of a node's descendants in the document tree, | 8 * An indexable collection of a node's descendants in the document tree, |
| 9 * filtered so that only elements are in the collection. | 9 * filtered so that only elements are in the collection. |
| 10 */ | 10 */ |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 void removeWhere(bool test(Element element)) { | 136 void removeWhere(bool test(Element element)) { |
| 137 IterableMixinWorkaround.removeWhere(this, test); | 137 IterableMixinWorkaround.removeWhere(this, test); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void retainWhere(bool test(Element element)) { | 140 void retainWhere(bool test(Element element)) { |
| 141 IterableMixinWorkaround.retainWhere(this, test); | 141 IterableMixinWorkaround.retainWhere(this, test); |
| 142 } | 142 } |
| 143 | 143 |
| 144 dynamic reduce(dynamic initialValue, | 144 Element reduce(Element combine(Element value, Element element)) { |
| 145 dynamic combine(dynamic previousValue, Element element)) { | 145 return _filtered.reduce(combine); |
| 146 return _filtered.reduce(initialValue, combine); | |
| 147 } | 146 } |
| 148 | 147 |
| 149 dynamic fold(dynamic initialValue, | 148 dynamic fold(dynamic initialValue, |
| 150 dynamic combine(dynamic previousValue, Element element)) { | 149 dynamic combine(dynamic previousValue, Element element)) { |
| 151 return IterableMixinWorkaround.fold(this, initialValue, combine); | 150 return _filtered.fold(initialValue, combine); |
| 152 } | 151 } |
| 153 | 152 |
| 154 bool every(bool f(Element element)) => _filtered.every(f); | 153 bool every(bool f(Element element)) => _filtered.every(f); |
| 155 bool any(bool f(Element element)) => _filtered.any(f); | 154 bool any(bool f(Element element)) => _filtered.any(f); |
| 156 List<Element> toList({ bool growable: true }) => | 155 List<Element> toList({ bool growable: true }) => |
| 157 new List<Element>.from(this, growable: growable); | 156 new List<Element>.from(this, growable: growable); |
| 158 Set<Element> toSet() => new Set<Element>.from(this); | 157 Set<Element> toSet() => new Set<Element>.from(this); |
| 159 Element firstWhere(bool test(Element value), {Element orElse()}) { | 158 Element firstWhere(bool test(Element value), {Element orElse()}) { |
| 160 return _filtered.firstWhere(test, orElse: orElse); | 159 return _filtered.firstWhere(test, orElse: orElse); |
| 161 } | 160 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 Element get single => _filtered.single; | 210 Element get single => _filtered.single; |
| 212 | 211 |
| 213 Element min([int compare(Element a, Element b)]) => _filtered.min(compare); | 212 Element min([int compare(Element a, Element b)]) => _filtered.min(compare); |
| 214 | 213 |
| 215 Element max([int compare(Element a, Element b)]) => _filtered.max(compare); | 214 Element max([int compare(Element a, Element b)]) => _filtered.max(compare); |
| 216 | 215 |
| 217 Map<int, Element> asMap() { | 216 Map<int, Element> asMap() { |
| 218 return IterableMixinWorkaround.asMapList(this); | 217 return IterableMixinWorkaround.asMapList(this); |
| 219 } | 218 } |
| 220 } | 219 } |
| OLD | NEW |