Class ArrayCollector<E>

All Implemented Interfaces:
Iterable<E>, Consumer<E>, CapacityCarrying, CapacityExtendable, ConsolidatableCollection, ExtendedBag<E>, ExtendedCollection<E>, ExtendedList<E>, ExtendedSequence<E>, OptimizableCollection, ReleasingCollection<E>, Sized, Truncateable, Sortable<E>, SortableProcedure<E>, XAddGetCollection<E>, XAddingBag<E>, XAddingCollection<E>, XAddingList<E>, XAddingSequence<E>, XBag<E>, XBasicList<E>, XBasicSequence<E>, XCollection<E>, XDecreasingList<E>, XDecreasingSequence<E>, XExpandingList<E>, XExpandingSequence<E>, XExtendingList<E>, XExtendingSequence<E>, XGettingBag<E>, XGettingCollection<E>, XGettingList<E>, XGettingSequence<E>, XIncreasingList<E>, XIncreasingSequence<E>, XIndexIterable<E>, XInputtingList<E>, XInputtingSequence<E>, XInsertingSequence<E>, XIterable<E>, XJoinable<E>, XList<E>, XOrderingSequence<E>, XPrependingList<E>, XPrependingSequence<E>, XPreputtingList<E>, XPreputtingSequence<E>, XProcessingBag<E>, XProcessingCollection<E>, XProcessingList<E>, XProcessingSequence<E>, XPutGetBag<E>, XPutGetCollection<E>, XPutGetList<E>, XPutGetSequence<E>, XPuttingBag<E>, XPuttingCollection<E>, XPuttingList<E>, XPuttingSequence<E>, XRemovingBag<E>, XRemovingCollection<E>, XRemovingList<E>, XRemovingSequence<E>, XReplacingBag<E>, XReplacingCollection<E>, XSequence<E>, XSettingList<E>, XSettingSequence<E>, XSortableSequence<E>, Processable<E>, Clearable, Copyable

public final class ArrayCollector<E>
extends AbstractSimpleArrayCollection<E>
implements XList<E>
Full scale general purpose implementation of extended collection type XList.

This array-backed implementation is optimal for all needs of a list that do not require frequent structural modification (insert or remove) of single elements before the end of the list.
It is recommended to use this implementation as default list type until concrete performance deficiencies are identified. If used properly (e.g. always ensure enough capacity, make use of batch procedures like inputAll(long,Object...), removeRange(long,long), etc.), this implementation has equal or massively superior performance to linked-list implementation is most cases.

This implementation is NOT synchronized and thus should only be used by a single thread or in a thread-safe manner (i.e. read-only as soon as multiple threads access it).
See SynchList wrapper class to use a list in a synchronized manner.

Note that this List implementation does NOT keep track of modification count as JDK's collection implementations do (and thus never throws a ConcurrentModificationException), for two reasons:
1.) It is already explicitly declared thread-unsafe and for single-thread (or thread-safe) use only.
2.) The common modCount-concurrency exception behavior ("failfast") has buggy and inconsistent behavior by throwing ConcurrentModificationException even in single thread use, i.e. when iterating over a collection and removing more than one element of it without using the iterator's method.

Current conclusion is that the JDK's failfast implementations buy unneeded (and even unreliable as stated by official guides) concurrency modification recognition at the cost of performance loss and even a bug when already used in a thread-safe manner.

Also note that by being an extended collection, this implementation offers various functional and batch procedures to maximize internal iteration potential, eliminating the need to use the ill-conceived external iteration Iterator paradigm.

0.9, 2011-02-06