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

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

Issue 9416053: Revert "Wrote functions to convert collections and maps to strings and invoked" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « corelib/src/implementation/maps.dart ('k') | corelib/src/implementation/splay_tree.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) 2012, 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> {
11 DoubleLinkedQueueEntry<E> _previous; 11 DoubleLinkedQueueEntry<E> _previous;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 DoubleLinkedQueueEntry<E> nextEntry = entry._next; 224 DoubleLinkedQueueEntry<E> nextEntry = entry._next;
225 if (f(entry._element)) other.addLast(entry._element); 225 if (f(entry._element)) other.addLast(entry._element);
226 entry = nextEntry; 226 entry = nextEntry;
227 } 227 }
228 return other; 228 return other;
229 } 229 }
230 230
231 _DoubleLinkedQueueIterator<E> iterator() { 231 _DoubleLinkedQueueIterator<E> iterator() {
232 return new _DoubleLinkedQueueIterator<E>(_sentinel); 232 return new _DoubleLinkedQueueIterator<E>(_sentinel);
233 } 233 }
234
235 String toString() {
236 return Collections.collectionToString(this);
237 }
238 } 234 }
239 235
240 class _DoubleLinkedQueueIterator<E> implements Iterator<E> { 236 class _DoubleLinkedQueueIterator<E> implements Iterator<E> {
241 final _DoubleLinkedQueueEntrySentinel<E> _sentinel; 237 final _DoubleLinkedQueueEntrySentinel<E> _sentinel;
242 DoubleLinkedQueueEntry<E> _currentEntry; 238 DoubleLinkedQueueEntry<E> _currentEntry;
243 239
244 _DoubleLinkedQueueIterator(_DoubleLinkedQueueEntrySentinel this._sentinel) { 240 _DoubleLinkedQueueIterator(_DoubleLinkedQueueEntrySentinel this._sentinel) {
245 _currentEntry = _sentinel; 241 _currentEntry = _sentinel;
246 } 242 }
247 243
248 bool hasNext() { 244 bool hasNext() {
249 return _currentEntry._next !== _sentinel; 245 return _currentEntry._next !== _sentinel;
250 } 246 }
251 247
252 E next() { 248 E next() {
253 if (!hasNext()) { 249 if (!hasNext()) {
254 throw const NoMoreElementsException(); 250 throw const NoMoreElementsException();
255 } 251 }
256 _currentEntry = _currentEntry._next; 252 _currentEntry = _currentEntry._next;
257 return _currentEntry.element; 253 return _currentEntry.element;
258 } 254 }
259 } 255 }
OLDNEW
« no previous file with comments | « corelib/src/implementation/maps.dart ('k') | corelib/src/implementation/splay_tree.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698