Class AbstractLinkedDeque<E>
java.lang.Object
java.util.AbstractCollection<E>
com.github.benmanes.caffeine.cache.AbstractLinkedDeque<E>
- Type Parameters:
E
- the type of elements held in this collection
- All Implemented Interfaces:
LinkedDeque<E>
,Iterable<E>
,Collection<E>
,Deque<E>
,Queue<E>
,SequencedCollection<E>
- Direct Known Subclasses:
AccessOrderDeque
,WriteOrderDeque
This class provides a skeletal implementation of the
LinkedDeque
interface to minimize
the effort required to implement this interface.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class
Nested classes/interfaces inherited from interface com.github.benmanes.caffeine.cache.LinkedDeque
LinkedDeque.PeekingIterator<E>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
void
void
(package private) void
void
clear()
abstract boolean
element()
getFirst()
getLast()
boolean
isEmpty()
boolean
Returns if the element is at the front of the deque.boolean
Returns if the element is at the back of the deque.iterator()
(package private) void
Links the element to the front of the deque so that it becomes the first element.(package private) void
Links the element to the back of the deque so that it becomes the last element.void
moveToBack
(E e) Moves the element to the back of the deque so that it becomes the last element.void
moveToFront
(E e) Moves the element to the front of the deque so that it becomes the first element.boolean
boolean
offerFirst
(E e) boolean
@Nullable E
peek()
@Nullable E
@Nullable E
peekLast()
@Nullable E
poll()
@Nullable E
@Nullable E
pollLast()
pop()
void
remove()
boolean
removeAll
(Collection<?> c) boolean
boolean
int
size()
(package private) void
Unlinks the non-null element.(package private) E
Unlinks the non-null first element.(package private) E
Unlinks the non-null last element.Methods inherited from class java.util.AbstractCollection
addAll, containsAll, remove, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
containsAll, equals, hashCode, parallelStream, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
Methods inherited from interface com.github.benmanes.caffeine.cache.LinkedDeque
getNext, getPrevious, setNext, setPrevious
-
Field Details
-
Constructor Details
-
AbstractLinkedDeque
AbstractLinkedDeque()
-
-
Method Details
-
linkFirst
Links the element to the front of the deque so that it becomes the first element.- Parameters:
e
- the unlinked element
-
linkLast
Links the element to the back of the deque so that it becomes the last element.- Parameters:
e
- the unlinked element
-
unlinkFirst
E unlinkFirst()Unlinks the non-null first element. -
unlinkLast
E unlinkLast()Unlinks the non-null last element. -
unlink
Unlinks the non-null element. -
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<E>
- Overrides:
isEmpty
in classAbstractCollection<E>
-
checkNotEmpty
void checkNotEmpty() -
size
public int size()Beware that, unlike in most collections, this method is NOT a constant-time operation.
- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceDeque<E>
- Specified by:
size
in classAbstractCollection<E>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<E>
- Overrides:
clear
in classAbstractCollection<E>
-
contains
- Specified by:
contains
in interfaceCollection<E>
- Specified by:
contains
in interfaceDeque<E>
- Overrides:
contains
in classAbstractCollection<E>
-
isFirst
Description copied from interface:LinkedDeque
Returns if the element is at the front of the deque.- Specified by:
isFirst
in interfaceLinkedDeque<E>
- Parameters:
e
- the linked element
-
isLast
Description copied from interface:LinkedDeque
Returns if the element is at the back of the deque.- Specified by:
isLast
in interfaceLinkedDeque<E>
- Parameters:
e
- the linked element
-
moveToFront
Description copied from interface:LinkedDeque
Moves the element to the front of the deque so that it becomes the first element.- Specified by:
moveToFront
in interfaceLinkedDeque<E>
- Parameters:
e
- the linked element
-
moveToBack
Description copied from interface:LinkedDeque
Moves the element to the back of the deque so that it becomes the last element.- Specified by:
moveToBack
in interfaceLinkedDeque<E>
- Parameters:
e
- the linked element
-
peek
-
peekFirst
-
peekLast
-
getFirst
-
getLast
-
element
-
offer
-
offerFirst
- Specified by:
offerFirst
in interfaceDeque<E>
-
offerLast
-
add
-
addFirst
-
addLast
-
poll
-
pollFirst
-
pollLast
-
remove
-
removeFirst
- Specified by:
removeFirst
in interfaceDeque<E>
- Specified by:
removeFirst
in interfaceSequencedCollection<E>
-
removeFirstOccurrence
- Specified by:
removeFirstOccurrence
in interfaceDeque<E>
-
removeLast
- Specified by:
removeLast
in interfaceDeque<E>
- Specified by:
removeLast
in interfaceSequencedCollection<E>
-
removeLastOccurrence
- Specified by:
removeLastOccurrence
in interfaceDeque<E>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<E>
- Overrides:
removeAll
in classAbstractCollection<E>
-
push
-
pop
-
iterator
- Specified by:
iterator
in interfaceCollection<E>
- Specified by:
iterator
in interfaceDeque<E>
- Specified by:
iterator
in interfaceIterable<E>
- Specified by:
iterator
in interfaceLinkedDeque<E>
- Specified by:
iterator
in classAbstractCollection<E>
-
descendingIterator
- Specified by:
descendingIterator
in interfaceDeque<E>
- Specified by:
descendingIterator
in interfaceLinkedDeque<E>
-