Class ArrayQueue<T>
java.lang.Object
ArrayQueue<T>
- All Implemented Interfaces:
QueueInterface<T>
- Direct Known Subclasses:
ArrayDeque
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all entries from the queue.dequeue()Removes and returns the element at the front of the queue.voidAdds a new entry to the back of this queue.getFront()Retrieves the element at the front of this queue.booleanisEmpty()Determines if there are any elements in the queue.
-
Constructor Details
-
ArrayQueue
public ArrayQueue() -
ArrayQueue
public ArrayQueue(int initialCapacity)
-
-
Method Details
-
enqueue
Description copied from interface:QueueInterfaceAdds a new entry to the back of this queue.- Specified by:
enqueuein interfaceQueueInterface<T>- Parameters:
element- element to be added to the queue
-
getFront
Description copied from interface:QueueInterfaceRetrieves the element at the front of this queue. The size of the queue is not changed.- Specified by:
getFrontin interfaceQueueInterface<T>- Returns:
- The element at the front of the queue.
-
dequeue
Description copied from interface:QueueInterfaceRemoves and returns the element at the front of the queue. The size of the queue is decreased by one.- Specified by:
dequeuein interfaceQueueInterface<T>- Returns:
- The element at the front of the queue
-
isEmpty
public boolean isEmpty()Description copied from interface:QueueInterfaceDetermines if there are any elements in the queue.- Specified by:
isEmptyin interfaceQueueInterface<T>- Returns:
- True if the queue is empty.
-
clear
public void clear()Description copied from interface:QueueInterfaceRemoves all entries from the queue.- Specified by:
clearin interfaceQueueInterface<T>
-