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

Side by Side Diff: sdk/lib/collection/queue.dart

Issue 26681002: Add EfficientLength marker interface to some iterabels. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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
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 part of dart.collection; 5 part of dart.collection;
6 6
7 /** 7 /**
8 * A [Queue] is a collection that can be manipulated at both ends. One 8 * A [Queue] is a collection that can be manipulated at both ends. One
9 * can iterate over the elements of a queue through [forEach] or with 9 * can iterate over the elements of a queue through [forEach] or with
10 * an [Iterator]. 10 * an [Iterator].
11 */ 11 */
12 abstract class Queue<E> implements Iterable<E> { 12 abstract class Queue<E> implements Iterable<E>, EfficientLength {
sra1 2013/10/09 21:16:53 This is what is scary about tag interfaces. They a
floitsch 2013/10/10 13:04:53 I partially agree. However we already did "is Queu
sra1 2013/10/10 17:02:41 There are many interesting queue algorithms that d
floitsch 2013/10/10 17:12:05 The List interface specifies that its length must
13 13
14 /** 14 /**
15 * Creates a queue. 15 * Creates a queue.
16 */ 16 */
17 factory Queue() => new ListQueue<E>(); 17 factory Queue() => new ListQueue<E>();
18 18
19 /** 19 /**
20 * Creates a queue with the elements of [other]. The order in 20 * Creates a queue with the elements of [other]. The order in
21 * the queue will be the order provided by the iterator of [other]. 21 * the queue will be the order provided by the iterator of [other].
22 */ 22 */
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 _queue._checkModification(_modificationCount); 696 _queue._checkModification(_modificationCount);
697 if (_position == _end) { 697 if (_position == _end) {
698 _current = null; 698 _current = null;
699 return false; 699 return false;
700 } 700 }
701 _current = _queue._table[_position]; 701 _current = _queue._table[_position];
702 _position = (_position + 1) & (_queue._table.length - 1); 702 _position = (_position + 1) & (_queue._table.length - 1);
703 return true; 703 return true;
704 } 704 }
705 } 705 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698