Top Description Fields Constructors Methods
org.eclipse.collections.impl.list.mutable

public final Class ArrayListAdapter<T>

extends AbstractListAdapter<T>
implements RandomAccess, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.util.RandomAccess
Imports
java.io.Serializable, java.util.ArrayList, .Comparator, .RandomAccess, org.eclipse.collections.api.block.HashingStrategy, org.eclipse.collections.api.block.function.Function, .Function0, .Function2, org.eclipse.collections.api.block.predicate.Predicate, .Predicate2, org.eclipse.collections.api.block.procedure.Procedure, org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure, org.eclipse.collections.api.factory.Lists, org.eclipse.collections.api.list.MutableList, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.partition.list.PartitionMutableList, org.eclipse.collections.api.tuple.Pair, org.eclipse.collections.impl.block.procedure.CollectionAddProcedure, org.eclipse.collections.impl.multimap.list.FastListMultimap, org.eclipse.collections.impl.utility.ArrayIterate, .ArrayListIterate, org.eclipse.collections.impl.utility.internal.RandomAccessListIterate

This class provides a MutableList wrapper around a JDK Collections ArrayList instance. All the MutableList interface methods are supported in addition to the JDK ArrayList methods.

To create a new wrapper around an existing ArrayList instance, use the adapt(ArrayList) factory method. To create a new empty wrapper, use the newList() or newList(int) factory methods.

Field Summary

Modifier and TypeField and Description
private final ArrayList<T>
private static final long

Constructor Summary

AccessConstructor and Description
private
ArrayListAdapter(ArrayList<T> newDelegate)

Method Summary

Modifier and TypeMethod and Description
public static <E> ArrayListAdapter<E>
adapt(ArrayList<E> newDelegate)

public boolean
allSatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter.allSatisfy.

Implements org.eclipse.collections.api.RichIterable.allSatisfy.

Returns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty.

public boolean
anySatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter.anySatisfy.

Implements org.eclipse.collections.api.RichIterable.anySatisfy.

Returns true if the predicate evaluates to true for any element of the iterable.

public MutableList<T>
public MutableList<T>
public ArrayListAdapter<T>
public <V> ArrayListAdapter<V>
collect(Function<? super T, ? extends V> function)

Overrides org.eclipse.collections.impl.list.mutable.AbstractListAdapter.collect.

Overrides default org.eclipse.collections.api.list.MutableList.collect.

Implements org.eclipse.collections.api.collection.MutableCollection.collect.

Returns a new MutableCollection with the results of applying the specified function to each element of the source collection.

public <V> ArrayListAdapter<V>
collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)

Overrides org.eclipse.collections.impl.list.mutable.AbstractListAdapter.collectIf.

Overrides default org.eclipse.collections.api.list.MutableList.collectIf.

Implements org.eclipse.collections.api.collection.MutableCollection.collectIf.

Returns a new MutableCollection with the results of applying the specified function to each element of the source collection, but only for elements that evaluate to true for the specified predicate.

public <P, A> ArrayListAdapter<A>
collectWith(Function2<? super T, ? super P, ? extends A> function, P parameter)

Overrides org.eclipse.collections.impl.list.mutable.AbstractListAdapter.collectWith.

Overrides default org.eclipse.collections.api.list.MutableList.collectWith.

Implements org.eclipse.collections.api.collection.MutableCollection.collectWith.

Same as collect(Function) with a Function2 and specified parameter which is passed to the block.

public <S> boolean
corresponds(OrderedIterable<S> other, Predicate2<? super T, ? super S> predicate)

Implements org.eclipse.collections.api.ordered.OrderedIterable.corresponds.

Returns true if both OrderedIterables have the same length and predicate returns true for all corresponding elements e1 of this OrderedIterable and e2 of other.

public int
count(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter.count.

Implements org.eclipse.collections.api.RichIterable.count.

Return the total number of elements that answer true to the specified predicate.

public T
detect(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter.detect.

Implements org.eclipse.collections.api.RichIterable.detect.

Returns the first element of the iterable for which the predicate evaluates to true or null in the case where no element returns true.

public T
detectIfNone(Predicate<? super T> predicate, Function0<? extends T> function)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter.detectIfNone.

Overrides default org.eclipse.collections.api.RichIterable.detectIfNone.

Returns the first element of the iterable for which the predicate evaluates to true.

public int
detectIndex(Predicate<? super T> predicate)

Implements org.eclipse.collections.api.ordered.OrderedIterable.detectIndex.

Returns the index of the first element of the OrderedIterable for which the predicate evaluates to true.

public int
detectLastIndex(Predicate<? super T> predicate)

Implements org.eclipse.collections.api.ordered.ReversibleIterable.detectLastIndex.

Returns the index of the last element of the ReversibleIterable for which the predicate evaluates to true.

public ArrayListAdapter<T>
distinct()

Implements org.eclipse.collections.api.list.MutableList.distinct.

Returns a new ListIterable containing the distinct elements in this list.

public ArrayListAdapter<T>
distinct(HashingStrategy<? super T> hashingStrategy)

Implements org.eclipse.collections.api.list.MutableList.distinct.

Returns a new ListIterable containing the distinct elements in this list.

public <V> ArrayListAdapter<T>
distinctBy(Function<? super T, ? extends V> function)

Overrides org.eclipse.collections.impl.list.mutable.AbstractListAdapter.distinctBy.

Implements org.eclipse.collections.api.list.MutableList.distinctBy.

Returns a new ListIterable containing the distinct elements in this list.

public MutableList<T>
drop(int count)

Implements org.eclipse.collections.api.list.MutableList.drop.

Returns an iterable after skipping the first count elements or an empty iterable if the count is greater than the length of the iterable.

public MutableList<T>
dropWhile(Predicate<? super T> predicate)

Implements org.eclipse.collections.api.list.MutableList.dropWhile.

Returns the final elements that do not satisfy the Predicate.

public void
each(Procedure<? super T> procedure)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter.each.

Implements org.eclipse.collections.api.RichIterable.each.

The procedure is executed for each element in the iterable.

public <V> ArrayListAdapter<V>
public void
forEach(int fromIndex, int toIndex, Procedure<? super T> procedure)

Implements org.eclipse.collections.api.ordered.OrderedIterable.forEach.

Iterates over the section of the iterable covered by the specified inclusive indexes.

public void
forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter.forEachWithIndex.

Implements org.eclipse.collections.api.InternalIterable.forEachWithIndex, org.eclipse.collections.api.ordered.OrderedIterable.forEachWithIndex.

Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.

public void
forEachWithIndex(int fromIndex, int toIndex, ObjectIntProcedure<? super T> objectIntProcedure)

Implements org.eclipse.collections.api.ordered.OrderedIterable.forEachWithIndex.

Iterates over the section of the iterable covered by the specified inclusive indexes.

protected ArrayList<T>
public <V> FastListMultimap<V, T>
groupBy(Function<? super T, ? extends V> function)

Overrides org.eclipse.collections.impl.list.mutable.AbstractListAdapter.groupBy.

Implements org.eclipse.collections.api.list.MutableList.groupBy, org.eclipse.collections.api.collection.MutableCollection.groupBy.

For each element of the iterable, the function is evaluated and the results of these evaluations are collected into a new multimap, where the transformed value is the key and the original values are added to the same (or similar) species of collection as the source iterable.

public <V> FastListMultimap<V, T>
groupByEach(Function<? super T, ? extends Iterable<V>> function)

Overrides org.eclipse.collections.impl.list.mutable.AbstractListAdapter.groupByEach.

Implements org.eclipse.collections.api.list.MutableList.groupByEach, org.eclipse.collections.api.collection.MutableCollection.groupByEach.

Similar to groupBy(Function), except the result of evaluating function will return a collection of keys for each value.

public <IV> IV
injectInto(IV injectedValue, Function2<? super IV, ? super T, ? extends IV> function)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter.injectInto.

Implements org.eclipse.collections.api.RichIterable.injectInto.

Returns the final result of evaluating function using each element of the iterable and the previous evaluation result as the parameters.

public ArrayListAdapter<T>
public static <E> ArrayListAdapter<E>
public static <E> ArrayListAdapter<E>
newList(int size)

public boolean
noneSatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter.noneSatisfy.

Implements org.eclipse.collections.api.RichIterable.noneSatisfy.

Returns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty.

public PartitionMutableList<T>
partition(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.list.mutable.AbstractListAdapter.partition.

Implements org.eclipse.collections.api.list.MutableList.partition, org.eclipse.collections.api.collection.MutableCollection.partition.

Filters a collection into a PartitionedIterable based on the evaluation of the predicate.

public PartitionMutableList<T>
partitionWhile(Predicate<? super T> predicate)

Implements org.eclipse.collections.api.list.MutableList.partitionWhile.

Returns a Partition of the initial elements that satisfy the Predicate and the remaining elements.

public <P> PartitionMutableList<T>
partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.list.mutable.AbstractListAdapter.partitionWith.

Implements org.eclipse.collections.api.list.MutableList.partitionWith, org.eclipse.collections.api.collection.MutableCollection.partitionWith.

Filters a collection into a PartitionIterable based on the evaluation of the predicate.

public ArrayListAdapter<T>
reject(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.list.mutable.AbstractListAdapter.reject.

Overrides default org.eclipse.collections.api.list.MutableList.reject.

Implements org.eclipse.collections.api.collection.MutableCollection.reject.

Returns a MutableCollection with all elements that evaluate to false for the specified predicate.

public <P> ArrayListAdapter<T>
rejectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.list.mutable.AbstractListAdapter.rejectWith.

Overrides default org.eclipse.collections.api.list.MutableList.rejectWith.

Implements org.eclipse.collections.api.collection.MutableCollection.rejectWith.

Returns a MutableCollection with all elements that evaluate to false for the specified predicate2 and parameter.

public void
reverseForEach(Procedure<? super T> procedure)

Overrides default org.eclipse.collections.api.ordered.ReversibleIterable.reverseForEach.

Evaluates the procedure for each element of the list iterating in reverse order.

public void
reverseForEachWithIndex(ObjectIntProcedure<? super T> procedure)

Overrides default org.eclipse.collections.api.ordered.ReversibleIterable.reverseForEachWithIndex.

Evaluates the procedure for each element and it's index in reverse order.

public ArrayListAdapter<T>
select(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.list.mutable.AbstractListAdapter.select.

Overrides default org.eclipse.collections.api.list.MutableList.select.

Implements org.eclipse.collections.api.collection.MutableCollection.select.

Returns a MutableCollection with all elements that evaluate to true for the specified predicate.

public <S> MutableList<S>
public <P> ArrayListAdapter<T>
selectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.list.mutable.AbstractListAdapter.selectWith.

Overrides default org.eclipse.collections.api.list.MutableList.selectWith.

Implements org.eclipse.collections.api.collection.MutableCollection.selectWith.

Returns a MutableCollection with all elements that evaluate to true for the specified predicate2 and parameter.

public void
sort(Comparator<? super T> comparator)

Overrides default java.util.List.sort.

Sorts this list according to the order induced by the specified Comparator (optional operation).

public ArrayListAdapter<T>
sortThis(Comparator<? super T> comparator)

Overrides default org.eclipse.collections.api.list.MutableList.sortThis.

Sorts the internal data structure of this list and returns the list itself as a convenience.

public ArrayListAdapter<T>
sortThis()

Overrides default org.eclipse.collections.api.list.MutableList.sortThis.

Sorts the internal data structure of this list and returns the list itself as a convenience.

public MutableList<T>
take(int count)

Implements org.eclipse.collections.api.list.MutableList.take.

Returns the first count elements of the iterable or all the elements in the iterable if count is greater than the length of the iterable.

public MutableList<T>
takeWhile(Predicate<? super T> predicate)

Implements org.eclipse.collections.api.list.MutableList.takeWhile.

Returns the initial elements that satisfy the Predicate.

public ArrayListAdapter<T>
with(T element)

Overrides default org.eclipse.collections.api.list.MutableList.with.

Implements org.eclipse.collections.api.collection.MutableCollection.with.

This method allows mutable and fixed size collections the ability to add elements to their existing elements.

public ArrayListAdapter<T>
with(T element1, T element2)

public ArrayListAdapter<T>
with(T element1, T element2, T element3)

public ArrayListAdapter<T>
with(T... elements)

Overrides default org.eclipse.collections.api.list.MutableList.with.

Implements org.eclipse.collections.api.collection.MutableCollection.with.

This method allows mutable and fixed size collections the ability to add elements to their existing elements.

public ArrayListAdapter<T>
withAll(Iterable<? extends T> elements)

Overrides default org.eclipse.collections.api.list.MutableList.withAll.

Implements org.eclipse.collections.api.collection.MutableCollection.withAll.

This method allows mutable and fixed size collections the ability to add multiple elements to their existing elements.

public ArrayListAdapter<T>
without(T element)

Overrides default org.eclipse.collections.api.list.MutableList.without.

Implements org.eclipse.collections.api.collection.MutableCollection.without.

This method allows mutable and fixed size collections the ability to remove elements from their existing elements.

public ArrayListAdapter<T>
withoutAll(Iterable<? extends T> elements)

Overrides default org.eclipse.collections.api.list.MutableList.withoutAll.

Implements org.eclipse.collections.api.collection.MutableCollection.withoutAll.

This method allows mutable and fixed size collections the ability to remove multiple elements from their existing elements.

private <E> ArrayListAdapter<E>
wrap(ArrayList<E> list)

public <S> MutableList<Pair<T, S>>
zip(Iterable<S> that)

Overrides org.eclipse.collections.impl.list.mutable.AbstractListAdapter.zip.

Implements org.eclipse.collections.api.list.MutableList.zip, org.eclipse.collections.api.collection.MutableCollection.zip.

Returns a RichIterable formed from this RichIterable and another RichIterable by combining corresponding elements in pairs.

public MutableList<Pair<T, Integer>>
Inherited from org.eclipse.collections.impl.list.mutable.AbstractListAdapter:
addaddAllasParallelasReversedequalsgethashCodeindexOflastIndexOflistIteratorlistIteratorremovesetsortThisByBooleansortThisByBytesortThisByCharsortThisByDoublesortThisByFloatsortThisByIntsortThisByLongsortThisByShortsubListtaptoStack