Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Unified Diff: sdk/lib/html/templates/html/impl/impl_Element.darttemplate

Issue 11412086: Make 'where' lazy. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Rebase Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/html/templates/html/impl/impl_Element.darttemplate
diff --git a/sdk/lib/html/templates/html/impl/impl_Element.darttemplate b/sdk/lib/html/templates/html/impl/impl_Element.darttemplate
index b055e471b234cc6c4d62dd3f8dfdaf6637ed23af..73abe6328c8abf4ed91664160320bf2c62dfcd84 100644
--- a/sdk/lib/html/templates/html/impl/impl_Element.darttemplate
+++ b/sdk/lib/html/templates/html/impl/impl_Element.darttemplate
@@ -31,15 +31,8 @@ class _ChildrenElementList implements List {
}
}
- List<Element> where(bool f(Element element)) {
- final output = [];
- forEach((Element element) {
- if (f(element)) {
- output.add(element);
- }
- });
- return new _FrozenElementList._wrap(output);
- }
+ Iterable<Element> where(bool f(Element element))
+ => new FilteredIterable<Element>(this, f);
bool every(bool f(Element element)) {
for (Element element in this) {
@@ -172,13 +165,8 @@ class _FrozenElementList implements List {
Iterable mappedBy(f(Element element)) => new MappedIterable(this, f);
- List<Element> where(bool f(Element element)) {
- final out = [];
- for (Element el in this) {
- if (f(el)) out.add(el);
- }
- return out;
- }
+ Iterable<Element> where(bool f(Element element))
+ => new FilteredIterable<Element>(this, f);
bool every(bool f(Element element)) {
for(Element element in this) {

Powered by Google App Engine
This is Rietveld 408576698