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>,java.lang.Iterable<E>,java.util.Collection<E>,java.util.Deque<E>,java.util.Queue<E>
- Direct Known Subclasses:
AccessOrderDeque,WriteOrderDeque
abstract class AbstractLinkedDeque<E> extends java.util.AbstractCollection<E> implements LinkedDeque<E>
This class provides a skeletal implementation of theLinkedDequeinterface to minimize the effort required to implement this interface.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classAbstractLinkedDeque.AbstractLinkedIterator-
Nested classes/interfaces inherited from interface com.github.benmanes.caffeine.cache.LinkedDeque
LinkedDeque.PeekingIterator<E>
-
-
Constructor Summary
Constructors Constructor Description AbstractLinkedDeque()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanadd(E e)voidaddFirst(E e)voidaddLast(E e)(package private) voidcheckNotEmpty()voidclear()abstract booleancontains(java.lang.Object o)LinkedDeque.PeekingIterator<E>descendingIterator()Eelement()EgetFirst()EgetLast()booleanisEmpty()booleanisFirst(E e)Returns if the element is at the front of the deque.booleanisLast(E e)Returns if the element is at the back of the deque.LinkedDeque.PeekingIterator<E>iterator()(package private) voidlinkFirst(E e)Links the element to the front of the deque so that it becomes the first element.(package private) voidlinkLast(E e)Links the element to the back of the deque so that it becomes the last element.voidmoveToBack(E e)Moves the element to the back of the deque so that it becomes the last element.voidmoveToFront(E e)Moves the element to the front of the deque so that it becomes the first element.booleanoffer(E e)booleanofferFirst(E e)booleanofferLast(E e)@Nullable Epeek()@Nullable EpeekFirst()@Nullable EpeekLast()@Nullable Epoll()@Nullable EpollFirst()@Nullable EpollLast()Epop()voidpush(E e)Eremove()booleanremoveAll(java.util.Collection<?> c)EremoveFirst()booleanremoveFirstOccurrence(java.lang.Object o)EremoveLast()booleanremoveLastOccurrence(java.lang.Object o)intsize()(package private) voidunlink(E e)Unlinks the non-null element.(package private) EunlinkFirst()Unlinks the non-null first element.(package private) EunlinkLast()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
-
-
-
-
Method Detail
-
linkFirst
void linkFirst(E e)
Links the element to the front of the deque so that it becomes the first element.- Parameters:
e- the unlinked element
-
linkLast
void linkLast(E e)
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
void unlink(E e)
Unlinks the non-null element.
-
isEmpty
public boolean isEmpty()
-
checkNotEmpty
void checkNotEmpty()
-
size
public int size()
Beware that, unlike in most collections, this method is NOT a constant-time operation.
-
clear
public void clear()
-
contains
public abstract boolean contains(java.lang.Object o)
-
isFirst
public boolean isFirst(E e)
Description copied from interface:LinkedDequeReturns if the element is at the front of the deque.- Specified by:
isFirstin interfaceLinkedDeque<E>- Parameters:
e- the linked element
-
isLast
public boolean isLast(E e)
Description copied from interface:LinkedDequeReturns if the element is at the back of the deque.- Specified by:
isLastin interfaceLinkedDeque<E>- Parameters:
e- the linked element
-
moveToFront
public void moveToFront(E e)
Description copied from interface:LinkedDequeMoves the element to the front of the deque so that it becomes the first element.- Specified by:
moveToFrontin interfaceLinkedDeque<E>- Parameters:
e- the linked element
-
moveToBack
public void moveToBack(E e)
Description copied from interface:LinkedDequeMoves the element to the back of the deque so that it becomes the last element.- Specified by:
moveToBackin interfaceLinkedDeque<E>- Parameters:
e- the linked element
-
peek
public @Nullable E peek()
-
element
public E element()
-
offer
public boolean offer(E e)
-
add
public boolean add(E e)
-
poll
public @Nullable E poll()
-
remove
public E remove()
-
removeFirstOccurrence
public boolean removeFirstOccurrence(java.lang.Object o)
- Specified by:
removeFirstOccurrencein interfacejava.util.Deque<E>
-
removeLastOccurrence
public boolean removeLastOccurrence(java.lang.Object o)
- Specified by:
removeLastOccurrencein interfacejava.util.Deque<E>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
-
iterator
public LinkedDeque.PeekingIterator<E> iterator()
-
descendingIterator
public LinkedDeque.PeekingIterator<E> descendingIterator()
- Specified by:
descendingIteratorin interfacejava.util.Deque<E>- Specified by:
descendingIteratorin interfaceLinkedDeque<E>
-
-