The BoundedFifoBuffer is a very efficient implementation of Buffer that does not alter the size of the buffer at runtime.
The removal order of a BoundedFifoBuffer
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.
The {@link #add(Object)}, {@link #remove()} and {@link #get()} operationsall perform in constant time. All other operations perform in linear time or worse.
Note that this implementation is not synchronized. The following can be used to provide synchronized access to your BoundedFifoBuffer
:
Buffer fifo = BufferUtils.synchronizedBuffer(new BoundedFifoBuffer());
This buffer prevents null objects from being added.
@since Commons Collections 3.0 (previously in main package v2.1)
@version $Revision: 1.6 $ $Date: 2004/01/14 21:43:08 $
@author Avalon
@author Berin Loritsch
@author Paul Jack
@author Stephen Colebourne
@author Herve Quiroz