Top Description Inners Methods
com.github.benmanes.caffeine.cache

pack-priv Interface LinkedDeque<E>

extends Deque<E>
Known Direct Implementers
com.github.benmanes.caffeine.cache.AbstractLinkedDeque
Type Parameters
<E>
the type of elements held in this collection
Imports
java.util.Comparator, .ConcurrentModificationException, .Deque, .Iterator, .NoSuchElementException, org.checkerframework.checker.nullness.qual.Nullable

A linked list extension of the Deque interface where the link pointers are tightly integrated with the element. Linked deques have no capacity restrictions; they grow as necessary to support usage. They are not thread-safe; in the absence of external synchronization, they do not support concurrent access by multiple threads. Null elements are prohibited.

Most LinkedDeque operations run in constant time by assuming that the element parameter is associated with the deque instance. Any usage that violates this assumption will result in non-deterministic behavior.

An element can exist in only one instance of a deque implementation, but may exist in multiple implementations. Each implementation must define unique names for accessing and modifying its link pointers.

The iterators returned by this class are fail-fast: If the deque is structurally modified at any time after the iterator is created, in any way except through the iterator's own remove method, then the iterator will throw a ConcurrentModificationException. Thus, in the face of concurrent modification, the iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future. Note that the fail-fast behavior of an iterator cannot be guaranteed and should be used only to detect bugs.

Author
[email protected] (Ben Manes)

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface

Method Summary

Modifier and TypeMethod and Description
public LinkedDeque.PeekingIterator<E>
descendingIterator()

Redeclares java.util.Deque.descendingIterator.

Returns an iterator over the elements in this deque in reverse sequential order.
public @Nullable E
getNext(E e)

Retrieves the next element or null if either the element is unlinked or the last element on the deque.

public @Nullable E
getPrevious(E e)

Retrieves the previous element or null if either the element is unlinked or the first element on the deque.

public boolean
isFirst(E
the linked element
e
)

Returns if the element is at the front of the deque.

public boolean
isLast(E
the linked element
e
)

Returns if the element is at the back of the deque.

public LinkedDeque.PeekingIterator<E>
iterator()

Redeclares java.util.Deque.iterator.

Returns an iterator over the elements in this deque in proper sequence.
public void
moveToBack(E
the linked element
e
)

Moves the element to the back of the deque so that it becomes the last element.

public void
moveToFront(E
the linked element
e
)

Moves the element to the front of the deque so that it becomes the first element.

public void
setNext(E e, @Nullable E next)

Sets the next element or null if there is no link.

public void
setPrevious(E e, @Nullable E prev)

Sets the previous element or null if there is no link.

Inherited from java.util.Deque:
addaddAlladdFirstaddLastcontainselementgetFirstgetLastofferofferFirstofferLastpeekpeekFirstpeekLastpollpollFirstpollLastpoppushremoveremoveremoveFirstremoveFirstOccurrenceremoveLastremoveLastOccurrencereversedsize

Method Detail

descendingIteratorback to summary
public LinkedDeque.PeekingIterator<E> descendingIterator()

Redeclares java.util.Deque.descendingIterator.

Doc from java.util.Deque.descendingIterator.

Returns an iterator over the elements in this deque in reverse sequential order. The elements will be returned in order from last (tail) to first (head).

Returns:LinkedDeque.PeekingIterator<E>

an iterator over the elements in this deque in reverse sequence

Annotations
@Override
getNextback to summary
public @Nullable E getNext(E e)

Retrieves the next element or null if either the element is unlinked or the last element on the deque.

getPreviousback to summary
public @Nullable E getPrevious(E e)

Retrieves the previous element or null if either the element is unlinked or the first element on the deque.

isFirstback to summary
public boolean isFirst(E e)

Returns if the element is at the front of the deque.

Parameters
e:E

the linked element

isLastback to summary
public boolean isLast(E e)

Returns if the element is at the back of the deque.

Parameters
e:E

the linked element

iteratorback to summary
public LinkedDeque.PeekingIterator<E> iterator()

Redeclares java.util.Deque.iterator.

Doc from java.util.Deque.iterator.

Returns an iterator over the elements in this deque in proper sequence. The elements will be returned in order from first (head) to last (tail).

Returns:LinkedDeque.PeekingIterator<E>

an iterator over the elements in this deque in proper sequence

Annotations
@Override
moveToBackback to summary
public void moveToBack(E e)

Moves the element to the back of the deque so that it becomes the last element.

Parameters
e:E

the linked element

moveToFrontback to summary
public void moveToFront(E e)

Moves the element to the front of the deque so that it becomes the first element.

Parameters
e:E

the linked element

setNextback to summary
public void setNext(E e, @Nullable E next)

Sets the next element or null if there is no link.

setPreviousback to summary
public void setPrevious(E e, @Nullable E prev)

Sets the previous element or null if there is no link.

com.github.benmanes.caffeine.cache back to summary

public Interface LinkedDeque.PeekingIterator<E>

extends Iterator<E>
Known Direct Implementers
com.github.benmanes.caffeine.cache.AbstractLinkedDeque.AbstractLinkedIterator

Method Summary

Modifier and TypeMethod and Description
public static <E> LinkedDeque.PeekingIterator<E>
comparing(LinkedDeque.PeekingIterator<E> first, LinkedDeque.PeekingIterator<E> second, Comparator<E> comparator)

Returns an iterator that selects the greater element from the backing iterators.

public static <E> LinkedDeque.PeekingIterator<E>
concat(LinkedDeque.PeekingIterator<E> first, LinkedDeque.PeekingIterator<E> second)

Returns an iterator that returns the first iteration followed by the second iteration.

public @Nullable E
peek()

Returns the next element in the iteration, without advancing the iteration.

Inherited from java.util.Iterator:
forEachRemaininghasNextnextremove

Method Detail

comparingback to summary
public static <E> LinkedDeque.PeekingIterator<E> comparing(LinkedDeque.PeekingIterator<E> first, LinkedDeque.PeekingIterator<E> second, Comparator<E> comparator)

Returns an iterator that selects the greater element from the backing iterators.

concatback to summary
public static <E> LinkedDeque.PeekingIterator<E> concat(LinkedDeque.PeekingIterator<E> first, LinkedDeque.PeekingIterator<E> second)

Returns an iterator that returns the first iteration followed by the second iteration.

peekback to summary
public @Nullable E peek()

Returns the next element in the iteration, without advancing the iteration.