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

Side by Side Diff: corelib/src/implementation/queue.dart

Issue 8931011: Update corelib to revised factory syntax. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « corelib/src/implementation/linked_hash_map.dart ('k') | corelib/src/isolate.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 5
6 /** 6 /**
7 * An entry in a doubly linked list. It contains a pointer to the next 7 * An entry in a doubly linked list. It contains a pointer to the next
8 * entry, the previous entry, and the boxed element. 8 * entry, the previous entry, and the boxed element.
9 */ 9 */
10 class DoubleLinkedQueueEntry<E> { 10 class DoubleLinkedQueueEntry<E> {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 * Implementation of a double linked list that box list elements into 95 * Implementation of a double linked list that box list elements into
96 * DoubleLinkedQueueEntry objects. 96 * DoubleLinkedQueueEntry objects.
97 */ 97 */
98 class DoubleLinkedQueue<E> implements Queue<E> { 98 class DoubleLinkedQueue<E> implements Queue<E> {
99 _DoubleLinkedQueueEntrySentinel<E> _sentinel; 99 _DoubleLinkedQueueEntrySentinel<E> _sentinel;
100 100
101 DoubleLinkedQueue() { 101 DoubleLinkedQueue() {
102 _sentinel = new _DoubleLinkedQueueEntrySentinel<E>(); 102 _sentinel = new _DoubleLinkedQueueEntrySentinel<E>();
103 } 103 }
104 104
105 // See issue 417. Works in the vm, fails in dartc and frog. 105 factory DoubleLinkedQueue.from(Iterable<E> other) {
106 factory DoubleLinkedQueue.from(Iterable/*<E>*/ other) { 106 Queue<E> list = new DoubleLinkedQueue();
107 Queue/*<E>*/ list = new DoubleLinkedQueue();
108 for (final e in other) { 107 for (final e in other) {
109 list.addLast(e); 108 list.addLast(e);
110 } 109 }
111 return list; 110 return list;
112 } 111 }
113 112
114 void addLast(E value) { 113 void addLast(E value) {
115 _sentinel.prepend(value); 114 _sentinel.prepend(value);
116 } 115 }
117 116
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 234 }
236 235
237 E next() { 236 E next() {
238 if (!hasNext()) { 237 if (!hasNext()) {
239 throw const NoMoreElementsException(); 238 throw const NoMoreElementsException();
240 } 239 }
241 _currentEntry = _currentEntry._next; 240 _currentEntry = _currentEntry._next;
242 return _currentEntry.element; 241 return _currentEntry.element;
243 } 242 }
244 } 243 }
OLDNEW
« no previous file with comments | « corelib/src/implementation/linked_hash_map.dart ('k') | corelib/src/isolate.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698