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

Unified Diff: corelib/src/implementation/queue.dart

Issue 9114021: Added method map to Collection interface and all its implementations (except classes generated fr... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 12 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
Index: corelib/src/implementation/queue.dart
===================================================================
--- corelib/src/implementation/queue.dart (revision 2973)
+++ corelib/src/implementation/queue.dart (working copy)
@@ -205,6 +205,18 @@
return false;
}
+ Queue map(f(E element)) {
+ Queue<E> other = new Queue();
ahe 2012/01/05 22:36:54 Remove <E>.
+ DoubleLinkedQueueEntry<E> entry = _sentinel._next;
+ while (entry !== _sentinel) {
+ DoubleLinkedQueueEntry<E> nextEntry = entry._next;
+ other.addLast(f(entry._element));
+ entry = nextEntry;
+ }
+ return other;
+ }
+
+
Queue<E> filter(bool f(E element)) {
Queue<E> other = new Queue<E>();
DoubleLinkedQueueEntry<E> entry = _sentinel._next;

Powered by Google App Engine
This is Rietveld 408576698