Class ArrayAdapter<T>

All Implemented Interfaces:
Serializable, Cloneable, Iterable<T>, Collection<T>, List<T>, RandomAccess, FixedSizeCollection<T>, MutableCollection<T>, InternalIterable<T>, FixedSizeList<T>, ListIterable<T>, MutableList<T>, OrderedIterable<T>, ReversibleIterable<T>, RichIterable<T>

public final class ArrayAdapter<T> extends AbstractArrayAdapter<T> implements Serializable, FixedSizeList<T>
This class provides a MutableList wrapper around an array. All the internal iteration methods of the MutableList interface as well as the JDK Collections List interface are provided. However, the pre-determined fixed-sized semantics of an array are maintained and thus mutating List interface methods such as AbstractMutableCollection.add(Object), AbstractArrayAdapter.addAll(Collection), AbstractArrayAdapter.remove(Object), AbstractArrayAdapter.removeAll(Collection), etc. are not supported and will throw an UnsupportedOperationException. In addition, the mutating iteration methods AbstractArrayAdapter.removeIf(org.eclipse.collections.api.block.predicate.Predicate) and AbstractArrayAdapter.removeIfWith(org.eclipse.collections.api.block.predicate.Predicate2, Object) are not supported and will also throw an UnsupportedOperationException.

The with(Object) method is not an exception to the above restrictions, as it will create a new instance of this class with the existing contents plus the new item.

To create a wrapper around an existing array, use the adapt(Object[]) factory method. To wrap the contents of an existing Collection instance, use the newArray(Iterable) or newArrayWithItem(Iterable, Object) factory methods. To wrap existing objects in a new array, use one of the newArrayWith(Object) factory methods.

See Also: