Package dsa.impl

Class LinkedQueue<T>

java.lang.Object
dsa.impl.LinkedQueue<T>
All Implemented Interfaces:
IQueue<T>

public class LinkedQueue<T> extends Object implements IQueue<T>
  • Constructor Details

    • LinkedQueue

      public LinkedQueue()
  • Method Details

    • enqueue

      public void enqueue(T value)
      Description copied from interface: IQueue
      Add element to the back of the queue.
      Specified by:
      enqueue in interface IQueue<T>
      Parameters:
      value -
    • dequeue

      public T dequeue()
      Description copied from interface: IQueue
      Remove and return the first element in the queue.
      Specified by:
      dequeue in interface IQueue<T>
      Returns:
    • size

      public int size()
      Description copied from interface: IQueue
      Get the number of elements in the queue.
      Specified by:
      size in interface IQueue<T>
      Returns:
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: IQueue
      Check if the queue is empty.
      Specified by:
      isEmpty in interface IQueue<T>
      Returns:
      true if the queue contains no elements, false otherwise.
    • front

      public T front()
      Description copied from interface: IQueue
      Get (but don't remove) the element at the front of the queue.
      Specified by:
      front in interface IQueue<T>
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object