Class LinkedDeque<T>
java.lang.Object
LinkedDeque<T>
- All Implemented Interfaces:
DequeInterface<T>,QueueInterface<T>
-
Nested Class Summary
Nested Classes -
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.voidclear()Removes all entries from the dequeue.dequeue()Removes and returns the element at the front of the queue.voidAdds a new entry to the back of this queue.getBack()Retrieves the element at the back of this dequeue.getFront()Retrieves the element at the front of this dequeue.booleanisEmpty()Determines if there are any elements in the dequeue.Removes and returns the element at the back of the dequeue.Removes and returns the element at the front of the dequeue.
-
Constructor Details
-
LinkedDeque
public LinkedDeque()
-
-
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
-
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.
-
getFront
Description copied from interface:DequeInterfaceRetrieves the element at the front of this dequeue. The size of the dequeue is not changed.- Specified by:
getFrontin interfaceDequeInterface<T>- Specified by:
getFrontin interfaceQueueInterface<T>- Returns:
- The element at the front 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
-
clear
public void clear()Description copied from interface:DequeInterfaceRemoves all entries from the dequeue.- Specified by:
clearin interfaceDequeInterface<T>- Specified by:
clearin interfaceQueueInterface<T>
-
isEmpty
public boolean isEmpty()Description copied from interface:DequeInterfaceDetermines if there are any elements in the dequeue.- Specified by:
isEmptyin interfaceDequeInterface<T>- Specified by:
isEmptyin interfaceQueueInterface<T>- Returns:
- True if the dequeue is empty.
-
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
-
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
-