Index: sdk/lib/core/queue.dart |
diff --git a/sdk/lib/core/queue.dart b/sdk/lib/core/queue.dart |
index 9a000c34143274a16c5d08f0f5829556efc2a59b..8f20efdcc7cb60614b6922238d85b7278d4d4262 100644 |
--- a/sdk/lib/core/queue.dart |
+++ b/sdk/lib/core/queue.dart |
@@ -201,6 +201,44 @@ class DoubleLinkedQueue<E> extends Iterable<E> implements Queue<E> { |
return _sentinel._next.remove(); |
} |
+ void remove(Object o) { |
+ DoubleLinkedQueueEntry<E> entry = firstEntry(); |
+ while (!identical(entry, _sentinel)) { |
+ if (entry.element == o) { |
+ entry.remove(); |
+ return; |
+ } |
+ entry = entry._next; |
+ } |
+ } |
+ |
+ void removeAll(Iterable elements) { |
+ // Use this method when remove is slow and removeMatching more efficient. |
+ IterableMixinWorkaround.removeAllList(this, elements); |
+ } |
+ |
+ void removeMatching(bool test(E element)) { |
+ DoubleLinkedQueueEntry<E> entry = firstEntry(); |
+ while (!identical(entry, _sentinel)) { |
+ DoubleLinkedQueueEntry<E> next = entry._next; |
+ if (test(entry.element)) { |
+ entry.remove(); |
+ } |
+ entry = next; |
+ } |
+ } |
+ |
+ void retainMatching(bool test(E element)) { |
+ DoubleLinkedQueueEntry<E> entry = firstEntry(); |
+ while (!identical(entry, _sentinel)) { |
+ DoubleLinkedQueueEntry<E> next = entry._next; |
+ if (!test(entry.element)) { |
+ entry.remove(); |
+ } |
+ entry = next; |
+ } |
+ } |
+ |
E get first { |
return _sentinel._next.element; |
} |