Interface QueueInterface<T>
- All Known Subinterfaces:
DequeInterface<T>
,PriorityQueueInterface<T>
- All Known Implementing Classes:
ArrayDeque
,ArrayQueue
,CircularLinkedQueue
,LinkedDeque
,LinkedPriorityQueue
,LinkedQueue
public interface QueueInterface<T>
-
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.
-
Method Details
-
enqueue
Adds a new entry to the back of this queue.- Parameters:
element
- element to be added to the queue
-
dequeue
T dequeue()Removes and returns the element at the front of the queue. The size of the queue is decreased by one.- Returns:
- The element at the front of the queue
- Throws:
EmptyQueueException
- if the queue is empty when the method is invoked
-
getFront
T getFront()Retrieves the element at the front of this queue. The size of the queue is not changed.- Returns:
- The element at the front of the queue.
- Throws:
EmptyQueueException
- if the queue is empty when the method is invoked
-
isEmpty
boolean isEmpty()Determines if there are any elements in the queue.- Returns:
- True if the queue is empty.
-
clear
void clear()Removes all entries from the queue.
-