Interface SmartDeque<E>
-
- Type Parameters:
E
- element class.
- All Superinterfaces:
Collection<E>
,Iterable<E>
,SmartCollection<E>
public interface SmartDeque<E> extends SmartCollection<E>
A double-ended queue (deque), allowing access, removal and insertion of elements both at the beginning and the end.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description E
getBack()
Retrieves the element at the end of the sequence, ornull
if the sequence is empty.ElementReference
getBackReference()
Retrieves the reference to the element at the end of the sequence, ornull
if the sequence is empty.E
getFront()
Retrieves the element at the beginning of the sequence, ornull
if the sequence is empty.ElementReference
getFrontReference()
Retrieves the reference to the element at the beginning of the sequence, ornull
if the sequence is empty.E
popBack()
Retrieves and removes the element at the beginning of the sequence.E
popFront()
Retrieves and removes the element at the beginning of the sequence.ElementReference
pushBack(E element)
Adds an element at the end of the sequence.ElementReference
pushFront(E element)
Adds an element at the beginning of the sequence.-
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray
-
Methods inherited from interface net.automatalib.common.smartcollection.SmartCollection
addAll, addAll, choose, chooseRef, deepClear, find, get, quickClear, referencedAdd, referenceIterator, references, remove, remove, replace
-
-
-
-
Method Detail
-
pushFront
ElementReference pushFront(E element)
Adds an element at the beginning of the sequence.- Parameters:
element
- the element to be added.- Returns:
- the reference to the newly added element.
-
pushBack
ElementReference pushBack(E element)
Adds an element at the end of the sequence.- Parameters:
element
- the element to be added.- Returns:
- the reference to the newly added element.
-
getFront
E getFront()
Retrieves the element at the beginning of the sequence, ornull
if the sequence is empty.- Returns:
- the first element or
null
.
-
getBack
E getBack()
Retrieves the element at the end of the sequence, ornull
if the sequence is empty.- Returns:
- the last element or
null
.
-
getFrontReference
ElementReference getFrontReference()
Retrieves the reference to the element at the beginning of the sequence, ornull
if the sequence is empty.- Returns:
- reference to the first element or
null
.
-
getBackReference
ElementReference getBackReference()
Retrieves the reference to the element at the end of the sequence, ornull
if the sequence is empty.- Returns:
- reference to the last element or
null
.
-
popFront
E popFront()
Retrieves and removes the element at the beginning of the sequence. If the sequence is empty,null
is returned.- Returns:
- the previously first element or
null
.
-
popBack
E popBack()
Retrieves and removes the element at the beginning of the sequence. If the sequence is empty,null
is returned.- Returns:
- the previously first element or
null
.
-
-