Class IntArrayQueue

  • public final class IntArrayQueue
    extends Object
    Array-based unbounded queue for int primitives with amortized O(1) add and remove.

    Use this class instead of a Deque to avoid boxing int primitives to Integer instances.

    • Constructor Detail

      • IntArrayQueue

        public IntArrayQueue()
    • Method Detail

      • add

        public void add​(int value)
        Add a new item to the queue.
      • remove

        public int remove()
        Remove an item from the queue.
        NoSuchElementException - if the queue is empty.
      • size

        public int size()
        Returns the number of items in the queue.
      • isEmpty

        public boolean isEmpty()
        Returns whether the queue is empty.
      • clear

        public void clear()
        Clears the queue.
      • capacity

        public int capacity()
        Returns the length of the backing array.