Class UnsynchronizedChunkyList<E>

  • Type Parameters:
    E - the type of elements in this list
    All Implemented Interfaces:
    ChunkyList<E>, Serializable, Iterable<E>, Collection<E>, List<E>

    public class UnsynchronizedChunkyList<E>
    extends AbstractList<E>
    implements ChunkyList<E>, Serializable
    An unrolled linked list implementation of ChunkyList, backed by a chain of fixed-size arrays (Chunks).

    This implementation is not thread-safe. If multiple threads access an UnsynchronizedChunkyList instance concurrently, and at least one of them modifies it structurally, it must be synchronized externally. A structural modification is any operation that adds or removes one or more elements, or explicitly resizes the list; merely setting the value of an element is not a structural modification.

    For concurrent access, it is recommended to use SynchronizedChunkyList, or to wrap the list at creation time:

         List list = Collections.synchronizedList(new UnsynchronizedChunkyList(...));
     

    The iterators returned by this class are fail-fast: if the list is structurally modified after the iterator is created, the iterator will throw a ConcurrentModificationException. This behaviour cannot be guaranteed in a concurrent context without external synchronization.

    See Also:
    Serialized Form