What is EvictingQueue ?
EvictingQueue is part of Google’s Guava library.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 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.
Let’s get started on Example
Visit My Repository for full code