Class LinkedQueue<T>
java.lang.Object
LinkedQueue<T>
- All Implemented Interfaces:
QueueInterface<T>
- Direct Known Subclasses:
LinkedPriorityQueue
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Removes all entries from the queue.dequeue()
Removes and returns the element at the front of the queue.void
Adds a new entry to the back of this queue.getFront()
Retrieves the element at the front of this queue.boolean
isEmpty()
Determines if there are any elements in the queue.
-
Constructor Details
-
LinkedQueue
public LinkedQueue()
-
-
Method Details
-
enqueue
Description copied from interface:QueueInterface
Adds a new entry to the back of this queue.- Specified by:
enqueue
in interfaceQueueInterface<T>
- Parameters:
element
- element to be added to the queue
-
getFront
Description copied from interface:QueueInterface
Retrieves the element at the front of this queue. The size of the queue is not changed.- Specified by:
getFront
in interfaceQueueInterface<T>
- Returns:
- The element at the front of the queue.
-
dequeue
Description copied from interface:QueueInterface
Removes and returns the element at the front of the queue. The size of the queue is decreased by one.- Specified by:
dequeue
in interfaceQueueInterface<T>
- Returns:
- The element at the front of the queue
-
isEmpty
public boolean isEmpty()Description copied from interface:QueueInterface
Determines if there are any elements in the queue.- Specified by:
isEmpty
in interfaceQueueInterface<T>
- Returns:
- True if the queue is empty.
-
clear
public void clear()Description copied from interface:QueueInterface
Removes all entries from the queue.- Specified by:
clear
in interfaceQueueInterface<T>
-