Class ChunkedArrayList<T>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<T>
org.apache.hadoop.util.ChunkedArrayList<T>
All Implemented Interfaces:
Iterable<T>, Collection<T>, List<T>

@Private public class ChunkedArrayList<T> extends AbstractList<T>
Simplified List implementation which stores elements as a list of chunks, each chunk having a maximum size. This improves over using an ArrayList in that creating a large list will never require a large amount of contiguous heap space -- thus reducing the likelihood of triggering a CMS compaction pause due to heap fragmentation. The first chunks allocated are small, but each additional chunk is 50% larger than the previous, ramping up to a configurable maximum chunk size. Reasonable defaults are provided which should be a good balance between not making any large allocations while still retaining decent performance. This currently only supports a small subset of List operations -- namely addition and iteration.