Interface CarbonQueue<T>

Type Parameters:
T - the type of objects stored in this queue.

public interface CarbonQueue<T>
represents a generic queue that can be used by the carbon platform.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Method to clear this queue.
    get(int index)
    Method to retrieve the element at the given index of this queue.
    int
    indexOf(T element)
    This method returns the index of the given element on this queue.
    boolean
    Method to test whether this queue is empty.
    Retrieves, but does not remove, the head of this queue.
    peek(int count)
    Retrieves, but does not remove, the given number of items from the top, which also includes the head of this queue.
    pop()
    Retrieves and removes, the head of this queue.
    pop(int count)
    Retrieves and removes, the given number of items from the top, which also includes the head of this queue.
    void
    push(List<T> elements)
    Adds the given elements onto the queue.
    void
    push(T element)
    Adds the given element onto the queue.
    int
    Method to obtain the size of this queue.
  • Method Details

    • peek

      T peek() throws QueueEmptyException
      Retrieves, but does not remove, the head of this queue.
      Returns:
      the head of this queue.
      Throws:
      QueueEmptyException - when this queue is empty.
    • peek

      List<T> peek(int count) throws QueueEmptyException
      Retrieves, but does not remove, the given number of items from the top, which also includes the head of this queue.
      Parameters:
      count - the number of items to return.
      Returns:
      the given number of items from the top, which also includes the head of this queue
      Throws:
      QueueEmptyException - when this queue is empty.
    • pop

      T pop() throws QueueEmptyException
      Retrieves and removes, the head of this queue.
      Returns:
      the head of this queue.
      Throws:
      QueueEmptyException - when this queue is empty.
    • pop

      List<T> pop(int count) throws QueueEmptyException
      Retrieves and removes, the given number of items from the top, which also includes the head of this queue.
      Parameters:
      count - the number of items to return.
      Returns:
      the given number of items from the top, which also includes the head of this queue.
      Throws:
      QueueEmptyException - when this queue is empty.
    • push

      void push(T element)
      Adds the given element onto the queue.
      Parameters:
      element - the element to add.
    • push

      void push(List<T> elements)
      Adds the given elements onto the queue.
      Parameters:
      elements - the elements to add.
    • size

      int size()
      Method to obtain the size of this queue.
      Returns:
      the size of this queue.
    • isEmpty

      boolean isEmpty()
      Method to test whether this queue is empty.
      Returns:
      true if the queue is empty or false if not.
    • clear

      void clear()
      Method to clear this queue.
    • indexOf

      int indexOf(T element) throws QueueEmptyException
      This method returns the index of the given element on this queue.
      Parameters:
      element - the element.
      Returns:
      the index of the given element.
      Throws:
      QueueEmptyException - when this queue is empty.
    • get

      T get(int index)
      Method to retrieve the element at the given index of this queue.
      Parameters:
      index - the index of the element.
      Returns:
      the element.