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 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.void
clear()
Removes all entries from the dequeue.dequeue()
Removes and returns the element at the front of the queue.void
Adds 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.boolean
isEmpty()
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: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
-
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.
-
getFront
Description copied from interface:DequeInterface
Retrieves the element at the front of this dequeue. The size of the dequeue is not changed.- Specified by:
getFront
in interfaceDequeInterface<T>
- Specified by:
getFront
in interfaceQueueInterface<T>
- Returns:
- The element at the front 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
-
clear
public void clear()Description copied from interface:DequeInterface
Removes all entries from the dequeue.- Specified by:
clear
in interfaceDequeInterface<T>
- Specified by:
clear
in interfaceQueueInterface<T>
-
isEmpty
public boolean isEmpty()Description copied from interface:DequeInterface
Determines if there are any elements in the dequeue.- Specified by:
isEmpty
in interfaceDequeInterface<T>
- Specified by:
isEmpty
in interfaceQueueInterface<T>
- Returns:
- True if the dequeue is empty.
-
enqueue
Description copied from interface:QueueInterface
Adds a new entry to the back of this queue.- Specified by:
enqueue
in interfaceQueueInterface<T>
- Parameters:
element
- element to be added to the queue
-
dequeue
Description copied from interface:QueueInterface
Removes and returns the element at the front of the queue. The size of the queue is decreased by one.- Specified by:
dequeue
in interfaceQueueInterface<T>
- Returns:
- The element at the front of the queue
-