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

Unified Diff: sdk/lib/core/queue.dart

Issue 11414069: Make mappedBy lazy. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Reupload due to error. 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/core/queue.dart
diff --git a/sdk/lib/core/queue.dart b/sdk/lib/core/queue.dart
index 15ebed34fb3d6790a161311d6285dc9761b30ec1..87462858176c29ba2818ed71d5c98836b66603aa 100644
--- a/sdk/lib/core/queue.dart
+++ b/sdk/lib/core/queue.dart
@@ -170,7 +170,7 @@ class _DoubleLinkedQueueEntrySentinel<E> extends DoubleLinkedQueueEntry<E> {
* WARNING: This class is temporary located in dart:core. It'll be removed
* at some point in the near future.
*/
-class DoubleLinkedQueue<E> implements Queue<E> {
+class DoubleLinkedQueue<E> extends Iterable<E> implements Queue<E> {
_DoubleLinkedQueueEntrySentinel<E> _sentinel;
DoubleLinkedQueue() {
@@ -227,12 +227,6 @@ class DoubleLinkedQueue<E> implements Queue<E> {
return _sentinel.nextEntry();
}
- int get length {
- int counter = 0;
- forEach((E element) { counter++; });
- return counter;
- }
-
bool get isEmpty {
return (identical(_sentinel._next, _sentinel));
}
@@ -242,15 +236,6 @@ class DoubleLinkedQueue<E> implements Queue<E> {
_sentinel._previous = _sentinel;
}
- void forEach(void f(E element)) {
- DoubleLinkedQueueEntry<E> entry = _sentinel._next;
- while (!identical(entry, _sentinel)) {
- DoubleLinkedQueueEntry<E> nextEntry = entry._next;
- f(entry._element);
- entry = nextEntry;
- }
- }
-
void forEachEntry(void f(DoubleLinkedQueueEntry<E> element)) {
DoubleLinkedQueueEntry<E> entry = _sentinel._next;
while (!identical(entry, _sentinel)) {
@@ -260,53 +245,6 @@ class DoubleLinkedQueue<E> implements Queue<E> {
}
}
- bool every(bool f(E element)) {
- DoubleLinkedQueueEntry<E> entry = _sentinel._next;
- while (!identical(entry, _sentinel)) {
- DoubleLinkedQueueEntry<E> nextEntry = entry._next;
- if (!f(entry._element)) return false;
- entry = nextEntry;
- }
- return true;
- }
-
- bool some(bool f(E element)) {
- DoubleLinkedQueueEntry<E> entry = _sentinel._next;
- while (!identical(entry, _sentinel)) {
- DoubleLinkedQueueEntry<E> nextEntry = entry._next;
- if (f(entry._element)) return true;
- entry = nextEntry;
- }
- return false;
- }
-
- Queue mappedBy(f(E element)) {
- Queue other = new Queue();
- DoubleLinkedQueueEntry<E> entry = _sentinel._next;
- while (!identical(entry, _sentinel)) {
- DoubleLinkedQueueEntry<E> nextEntry = entry._next;
- other.addLast(f(entry._element));
- entry = nextEntry;
- }
- return other;
- }
-
- Dynamic reduce(Dynamic initialValue,
- Dynamic combine(Dynamic previousValue, E element)) {
- return Collections.reduce(this, initialValue, combine);
- }
-
- Queue<E> where(bool f(E element)) {
- Queue<E> other = new Queue<E>();
- DoubleLinkedQueueEntry<E> entry = _sentinel._next;
- while (!identical(entry, _sentinel)) {
- DoubleLinkedQueueEntry<E> nextEntry = entry._next;
- if (f(entry._element)) other.addLast(entry._element);
- entry = nextEntry;
- }
- return other;
- }
-
_DoubleLinkedQueueIterator<E> get iterator {
return new _DoubleLinkedQueueIterator<E>(_sentinel);
}

Powered by Google App Engine
This is Rietveld 408576698