public class CircularFifoBuffer extends BoundedFifoBuffer
The removal order of a
CircularFifoBuffer is based on the
insertion order; elements are removed in the same order in which they
were added. The iteration order is the same as the removal order.
Note that this implementation is not synchronized. The following can be
used to provide synchronized access to your
Buffer fifo = BufferUtils.synchronizedBuffer(new CircularFifoBuffer());
This buffer prevents null objects from being added.
This class is Serializable from Commons Collections 3.1.
|Constructor and Description|
Constructor that creates a buffer with the default size of 32.
Constructor that creates a buffer from the specified collection.
Constructor that creates a buffer with the specified size.
|Modifier and Type||Method and Description|
If the buffer is full, the least recently added element is discarded so that a new element can be inserted.
clear, get, isEmpty, isFull, iterator, maxSize, remove, size
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
addAll, contains, containsAll, equals, hashCode, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray
public CircularFifoBuffer(int size)
size- the size of the buffer (cannot be changed)
java.lang.IllegalArgumentException- if the size is less than 1
public CircularFifoBuffer(java.util.Collection coll)
coll- the collection to copy into the buffer, may not be null
java.lang.NullPointerException- if the collection is null
public boolean add(java.lang.Object element)
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"