Class EvictingQueue<E>

  • All Implemented Interfaces:
    Serializable, Iterable<E>, Collection<E>, Queue<E>

    @GwtCompatible
    public final class EvictingQueue<E>
    extends ForwardingQueue<E>
    implements Serializable
    A non-blocking queue which automatically evicts elements from the head of the queue when attempting to add new elements onto the queue and it is full. This queue orders elements FIFO (first-in-first-out). This data structure is logically equivalent to a circular buffer (i.e., cyclic buffer or ring buffer).

    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.

    Since:
    15.0
    Author:
    Kurt Alfred Kluever
    See Also:
    Serialized Form