OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 import 'dart:collection'; | 5 import 'dart:collection'; |
6 | 6 |
7 /** | 7 /** |
8 * A class that efficiently implements both [Queue] and [List]. | 8 * A class that efficiently implements both [Queue] and [List]. |
9 */ | 9 */ |
10 // TODO(nweiz): Currently this code is copied almost verbatim from | 10 // TODO(nweiz): Currently this code is copied almost verbatim from |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 // Add 1.5x extra room to ensure that there's room for more elements after | 222 // Add 1.5x extra room to ensure that there's room for more elements after |
223 // expansion. | 223 // expansion. |
224 newElementCount += newElementCount >> 1; | 224 newElementCount += newElementCount >> 1; |
225 int newCapacity = _nextPowerOf2(newElementCount); | 225 int newCapacity = _nextPowerOf2(newElementCount); |
226 List<E> newTable = new List<E>(newCapacity); | 226 List<E> newTable = new List<E>(newCapacity); |
227 _tail = _writeToList(newTable); | 227 _tail = _writeToList(newTable); |
228 _table = newTable; | 228 _table = newTable; |
229 _head = 0; | 229 _head = 0; |
230 } | 230 } |
231 } | 231 } |
OLD | NEW |