Class Queue

java.lang.Object
org.forester.datastructures.Queue

public class Queue extends Object
  • Constructor Details

    • Queue

      public Queue()
      This created a new, empty Queue object.
  • Method Details

    • clear

      public void clear()
      Removes all elements from this queue.
    • dequeue

      public Object dequeue() throws NoSuchElementException
      Dequeues one element from this queue.
      Returns:
      the dequeued object
      Throws:
      NoSuchElementException - if this queue is empty
    • enqueue

      public void enqueue(Object element)
      Adds Object element to thisqueue.
      Parameters:
      element - the Object to be enqueued
    • isEmpty

      public boolean isEmpty()
      Returns whether or not this queue is empty.
      Returns:
      true if this queue is empty, false otherwise