UnboundedFifoBuffer is a very efficient implementation of
Buffer that can grow to any size.
According to performance testing, it exhibits a constant access time, but it
also outperforms ArrayList when used for the same purpose.
The removal order of an UnboundedFifoBuffer 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
UnboundedFifoBuffer.remove() and
UnboundedFifoBuffer.get() operations perform in constant time.
The
UnboundedFifoBuffer.add(Object) operation performs in amortized 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 UnboundedFifoBuffer :
Buffer fifo = BufferUtils.synchronizedBuffer(new UnboundedFifoBuffer());
This buffer prevents null objects from being added.
This class is Serializable from Commons Collections 3.1.
since: Commons Collections 3.0 (previously in main package v2.1) version: $Revision: 405927 $ $Date: 2006-05-12 23:57:03 +0100 (Fri, 12 May 2006) $ author: Avalon author: Federico Barbieri author: Berin Loritsch author: Paul Jack author: Stephen Colebourne author: Andreas Schlosser author: Thomas Knych author: Jordan Krey |