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

Unified Diff: sdk/lib/html/html_common/filtered_element_list.dart

Issue 11931034: Add methods to Collection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 11 months 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
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | sdk/lib/svg/dart2js/svg_dart2js.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/html_common/filtered_element_list.dart
diff --git a/sdk/lib/html/html_common/filtered_element_list.dart b/sdk/lib/html/html_common/filtered_element_list.dart
index 5f1f961bac5a61d736ae06440674923b8c189dba..44768c4fcacfe18698896ff9e4e59a48f3d16fcc 100644
--- a/sdk/lib/html/html_common/filtered_element_list.dart
+++ b/sdk/lib/html/html_common/filtered_element_list.dart
@@ -108,6 +108,36 @@ class FilteredElementList implements List {
return result;
}
+ void remove(Object element) {
+ if (element is! Element) return;
+ for (int i = 0; i < length; i++) {
+ Element indexElement = this[i];
+ if (identical(indexElement, element)) {
+ indexElement.remove();
+ return;
+ }
+ }
+ }
+
+ // Operations defined in terms of [Collections]' [remove].
+
+ void removeAll(Iterable elements) {
+ // This should be optimized to not use [remove] directly.
+ Collections.removeAll(this, elements);
+ }
+
+ void retainAll(Iterable elements) {
+ Collections.retainAll(this, elements);
+ }
+
+ void removeMatching(bool test(Element element)) {
+ Collections.removeMatching(this, test);
+ }
+
+ void retainMatching(bool test(Element element)) {
+ Collections.retainMatching(this, test);
+ }
+
dynamic reduce(dynamic initialValue,
dynamic combine(dynamic previousValue, Element element)) {
return IterableMixinWorkaround.reduce(this, initialValue, combine);
@@ -132,7 +162,6 @@ class FilteredElementList implements List {
return this[index];
}
-
bool get isEmpty => _filtered.isEmpty;
int get length => _filtered.length;
Element operator [](int index) => _filtered[index];
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | sdk/lib/svg/dart2js/svg_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698