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