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

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

Issue 1999793002: Make Iterable.toList more efficient if the length is known. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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: sdk/lib/collection/queue.dart
diff --git a/sdk/lib/collection/queue.dart b/sdk/lib/collection/queue.dart
index 816f62e78c4b59bb8187c658952229db169893f3..386cf50a03b6f36dcbceb28107c4063ea7bdf253 100644
--- a/sdk/lib/collection/queue.dart
+++ b/sdk/lib/collection/queue.dart
@@ -444,7 +444,7 @@ class _DoubleLinkedQueueIterator<E> implements Iterator<E> {
*
* The structure is efficient for any queue or stack usage.
*/
-class ListQueue<E> extends Iterable<E> implements Queue<E> {
+class ListQueue<E> extends ListIterable<E> implements Queue<E> {
static const int _INITIAL_CAPACITY = 8;
List<E> _table;
int _head;
@@ -478,7 +478,7 @@ class ListQueue<E> extends Iterable<E> implements Queue<E> {
factory ListQueue.from(Iterable elements) {
if (elements is List) {
int length = elements.length;
- ListQueue<E> queue = new ListQueue(length + 1);
+ ListQueue<E> queue = new ListQueue<E>(length + 1);
assert(queue._table.length > length);
for (int i = 0; i < length; i++) {
queue._table[i] = elements[i] as Object/*=E*/;

Powered by Google App Engine
This is Rietveld 408576698