@Beta @GwtIncompatible(value="java.util.ArrayDeque") public final class EvictingQueue<E> extends ForwardingQueue<E>
An evicting queue must be configured with a maximum size. Each time an element is added to a full queue, the queue automatically removes its head element. This is different from conventional bounded queues, which either block or reject new elements when full.
This class is not thread-safe, and does not accept null elements.
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e)
Adds the given element to this queue.
|
boolean |
addAll(Collection<? extends E> collection) |
boolean |
contains(Object object) |
static <E> EvictingQueue<E> |
create(int maxSize)
Creates and returns a new evicting queue that will hold up to
maxSize elements. |
boolean |
offer(E e)
Adds the given element to this queue.
|
boolean |
remove(Object object) |
element, peek, poll, removeclear, containsAll, isEmpty, iterator, removeAll, retainAll, size, toArray, toArraytoStringequals, getClass, hashCode, notify, notifyAll, wait, wait, waitclear, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArraypublic static <E> EvictingQueue<E> create(int maxSize)
maxSize elements.
When maxSize is zero, elements will be evicted immediately after being added to the
queue.
public boolean offer(E e)
public boolean add(E e)
add in interface Collection<E>add in interface Queue<E>add in class ForwardingCollection<E>true alwayspublic boolean addAll(Collection<? extends E> collection)
addAll in interface Collection<E>addAll in class ForwardingCollection<E>public boolean contains(Object object)
contains in interface Collection<E>contains in class ForwardingCollection<E>public boolean remove(Object object)
remove in interface Collection<E>remove in class ForwardingCollection<E>Copyright © 2010 - 2020 Adobe. All Rights Reserved