ListQueue<E> constructor

ListQueue<E>([int initialCapacity ])

Create an empty queue.

If initialCapacity is given, prepare the queue for at least that many elements.

Implementation

ListQueue([int initialCapacity])
    : _head = 0,
      _tail = 0 {
  if (initialCapacity == null || initialCapacity < _INITIAL_CAPACITY) {
    initialCapacity = _INITIAL_CAPACITY;
  } else if (!_isPowerOf2(initialCapacity)) {
    initialCapacity = _nextPowerOf2(initialCapacity);
  }
  assert(_isPowerOf2(initialCapacity));
  _table = List<E>(initialCapacity);
}