Class ArrayDeque<T>
java.lang.Object
ArrayQueue<T>
ArrayDeque<T>
- All Implemented Interfaces:
DequeInterface<T>,QueueInterface<T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new entry to the back of this dequeue.voidaddToFront(T element) Adds a new entry to the front of this dequeue.getBack()Retrieves the element at the back of this dequeue.getFront()Retrieves the element at the front of this queue.Removes and returns the element at the back of the dequeue.Removes and returns the element at the front of the dequeue.Methods inherited from class ArrayQueue
clear, dequeue, enqueue, isEmptyMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DequeInterface
clear, isEmptyMethods inherited from interface QueueInterface
dequeue, enqueue
-
Constructor Details
-
ArrayDeque
public ArrayDeque() -
ArrayDeque
public ArrayDeque(int initialCapacity)
-
-
Method Details
-
addToBack
Description copied from interface:DequeInterfaceAdds a new entry to the back of this dequeue.- Specified by:
addToBackin interfaceDequeInterface<T>- Parameters:
element- element to be added to the dequeue
-
addToFront
Description copied from interface:DequeInterfaceAdds a new entry to the front of this dequeue.- Specified by:
addToFrontin interfaceDequeInterface<T>- Parameters:
element- element to be added to the dequeue
-
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 interfaceDequeInterface<T>- Specified by:
getFrontin interfaceQueueInterface<T>- Overrides:
getFrontin classArrayQueue<T>- Returns:
- The element at the front of the queue.
-
getBack
Description copied from interface:DequeInterfaceRetrieves the element at the back of this dequeue. The size of the dequeue is not changed.- Specified by:
getBackin interfaceDequeInterface<T>- Returns:
- The element at the back of the dequeue.
-
removeFront
Description copied from interface:DequeInterfaceRemoves and returns the element at the front of the dequeue. The size of the dequeue is decreased by one.- Specified by:
removeFrontin interfaceDequeInterface<T>- Returns:
- The element at the front of the dequeue
-
removeBack
Description copied from interface:DequeInterfaceRemoves and returns the element at the back of the dequeue. The size of the dequeue is decreased by one.- Specified by:
removeBackin interfaceDequeInterface<T>- Returns:
- The element at the back of the dequeue
-