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

pack-priv final Class ImmutableArrayList<T>

extends AbstractImmutableList<T>
implements Serializable, RandomAccess, BatchIterable<T>
Class Inheritance
All Implemented Interfaces
org.eclipse.collections.impl.parallel.BatchIterable, java.util.RandomAccess, java.io.Serializable
Imports
java.io.Serializable, java.lang.reflect.Array, java.util.Arrays, .Collection, .DoubleSummaryStatistics, .IntSummaryStatistics, .Iterator, .List, .LongSummaryStatistics, .Optional, .RandomAccess, .Spliterator, .Spliterators, java.util.function.BiConsumer, .BinaryOperator, .Supplier, java.util.stream.Collector, org.eclipse.collections.api.block.function.Function, .Function2, org.eclipse.collections.api.block.function.primitive.DoubleFunction, .FloatFunction, .IntFunction, .LongFunction, .ObjectIntToObjectFunction, org.eclipse.collections.api.block.predicate.Predicate, .Predicate2, org.eclipse.collections.api.block.predicate.primitive.ObjectIntPredicate, 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.ImmutableList, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.partition.list.PartitionImmutableList, org.eclipse.collections.impl.block.factory.Predicates, .Predicates2, org.eclipse.collections.impl.list.mutable.FastList, org.eclipse.collections.impl.parallel.BatchIterable, org.eclipse.collections.impl.partition.list.PartitionImmutableListImpl, org.eclipse.collections.impl.utility.Iterate, .ListIterate, org.eclipse.collections.impl.utility.internal.InternalArrayIterate, .RandomAccessListIterate

An ImmutableArrayList wraps a Java array, but it cannot be modified after creation.

Field Summary

Modifier and TypeField and Description
private final T[]
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv
ImmutableArrayList(T[] newElements)

Method Summary

Modifier and TypeMethod and Description
public boolean
allSatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.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.AbstractRichIterable.anySatisfy.

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

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

public void
appendString(Appendable appendable, String start, String separator, String end)

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.appendString.

Implements org.eclipse.collections.api.RichIterable.appendString.

Prints a string representation of this collection onto the given Appendable.

public void
batchForEach(Procedure<? super T> procedure, int sectionIndex, int sectionCount)

Implements org.eclipse.collections.impl.parallel.BatchIterable.batchForEach.

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

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.collect.

Implements org.eclipse.collections.api.list.ImmutableList.collect, org.eclipse.collections.api.collection.ImmutableCollection.collect, org.eclipse.collections.api.RichIterable.collect.

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

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

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.collectIf.

Implements org.eclipse.collections.api.list.ImmutableList.collectIf, org.eclipse.collections.api.collection.ImmutableCollection.collectIf, org.eclipse.collections.api.RichIterable.collectIf.

Returns a new collection with the results of applying the specified function on each element of the source collection, but only for those elements which return true upon evaluation of the predicate.

public <P, V> ImmutableList<V>
public <P, V, R extends Collection<V>> R
collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter, R target)

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.collectWith.

Implements org.eclipse.collections.api.RichIterable.collectWith.

Same as collectWith but with a targetCollection parameter to gather the results.

public <V> ImmutableList<V>
collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function)

Overrides default org.eclipse.collections.api.list.ImmutableList.collectWithIndex.

Returns a new OrderedIterable using results obtained by applying the specified function to each element and its corresponding index.

public <V, R extends Collection<V>> R
collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function, R target)

Overrides default org.eclipse.collections.api.ordered.OrderedIterable.collectWithIndex.

Adds elements to the target Collection using results obtained by applying the specified function to each element and its corresponding index.

public boolean
public boolean
containsAll(Collection<?> collection)

Overrides org.eclipse.collections.impl.AbstractRichIterable.containsAll.

Implements org.eclipse.collections.api.RichIterable.containsAll, java.util.List.containsAll, java.util.Collection.containsAll.

Returns true if this list contains all of the elements of the specified collection.

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

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.corresponds.

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.list.immutable.AbstractImmutableList.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.AbstractRichIterable.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.

private int
detectNotIndex(Predicate<? super T> predicate)

public Optional<T>
detectOptional(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.detectOptional.

Implements org.eclipse.collections.api.RichIterable.detectOptional.

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

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

Overrides org.eclipse.collections.impl.AbstractRichIterable.detectWith.

Implements org.eclipse.collections.api.RichIterable.detectWith.

Returns the first element that evaluates to true for the specified predicate2 and parameter, or null if none evaluate to true.

public <P> Optional<T>
detectWithOptional(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.detectWithOptional.

Implements org.eclipse.collections.api.RichIterable.detectWithOptional.

Returns the first element that evaluates to true for the specified predicate2 and parameter as an Optional.

public ImmutableList<T>
drop(int count)

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.drop.

Implements org.eclipse.collections.api.list.ImmutableList.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 ImmutableList<T>
dropWhile(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.dropWhile.

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

Returns the final elements that do not satisfy the Predicate.

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

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

The procedure is executed for each element in the iterable.

public boolean
public <V> ImmutableList<V>
public <V, R extends Collection<V>> R
flatCollect(Function<? super T, ? extends Iterable<V>> function, R target)

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.flatCollect.

Implements org.eclipse.collections.api.RichIterable.flatCollect.

Same as flatCollect, only the results are collected into the target collection.

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

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.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 from, int to, ObjectIntProcedure<? super T> objectIntProcedure)

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.forEachWithIndex.

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

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

public T
get(int index)

Implements org.eclipse.collections.api.list.ListIterable.get, java.util.List.get.

Returns the element at the specified position in this list.

public int
public T
public T
public int
public boolean
public int
indexOf(Object item)

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.indexOf.

Overrides default org.eclipse.collections.api.ordered.OrderedIterable.indexOf.

Implements java.util.List.indexOf.

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

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

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.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 boolean
public Iterator<T>
public int
lastIndexOf(Object item)

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.lastIndexOf.

Implements org.eclipse.collections.api.list.ListIterable.lastIndexOf, java.util.List.lastIndexOf.

Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.

public <V extends Comparable<? super V>> T
maxBy(Function<? super T, ? extends V> function)

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.maxBy.

Implements org.eclipse.collections.api.RichIterable.maxBy.

Returns the maximum elements out of this container based on the natural order of the attribute returned by Function.

public <V extends Comparable<? super V>> T
minBy(Function<? super T, ? extends V> function)

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.minBy.

Implements org.eclipse.collections.api.RichIterable.minBy.

Returns the minimum elements out of this container based on the natural order of the attribute returned by Function.

public static <E> ImmutableArrayList<E>
newList(Iterable<? extends E> iterable)

public static <E> ImmutableArrayList<E>
newListWith(E... elements)

public ImmutableList<T>
newWith(T newItem)

Implements org.eclipse.collections.api.list.ImmutableList.newWith, org.eclipse.collections.api.collection.ImmutableCollection.newWith.

This method is similar to the with method in MutableCollection with the difference that a new copy of this collection with the element appended will be returned.

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

Overrides org.eclipse.collections.impl.AbstractRichIterable.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 boolean
notEmpty()

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

The English equivalent of !this.isEmpty()

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

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.partitionWhile.

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

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

public <P> PartitionImmutableList<T>
public Optional<T>
public <R, A> R
reduceInPlace(Collector<? super T, A, R> collector)

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

This method produces the equivalent result as Stream#collect(Collector).

public <R> R
reduceInPlace(Supplier<R> supplier, BiConsumer<R, ? super T> accumulator)

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

This method produces the equivalent result as Stream#collect(Supplier, BiConsumer, BiConsumer).

public ImmutableList<T>
public <P> ImmutableList<T>
public <P, R extends Collection<T>> R
rejectWith(Predicate2<? super T, ? super P> predicate, P parameter, R target)

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.rejectWith.

Implements org.eclipse.collections.api.RichIterable.rejectWith.

Similar to reject(Predicate, Collection), except with an evaluation parameter for the second generic argument in Predicate2.

public ImmutableList<T>
rejectWithIndex(ObjectIntPredicate<? super T> predicate)

Overrides default org.eclipse.collections.api.list.ImmutableList.rejectWithIndex.

Returns a new ImmutableList with all elements of the collection that return false when evaluating the specified predicate which is supplied each element and its relative index.

public <R extends Collection<T>> R
rejectWithIndex(ObjectIntPredicate<? super T> predicate, R target)

Overrides default org.eclipse.collections.api.ordered.OrderedIterable.rejectWithIndex.

Adds all elements to the target Collection that return false when evaluating the specified predicate which is supplied each element and its relative index.

public ImmutableList<T>
public <S> ImmutableList<S>
public <P> ImmutableList<T>
public <P, R extends Collection<T>> R
selectWith(Predicate2<? super T, ? super P> predicate, P parameter, R target)

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.selectWith.

Implements org.eclipse.collections.api.RichIterable.selectWith.

Similar to select(Predicate, Collection), except with an evaluation parameter for the second generic argument in Predicate2.

public ImmutableList<T>
selectWithIndex(ObjectIntPredicate<? super T> predicate)

Overrides default org.eclipse.collections.api.list.ImmutableList.selectWithIndex.

Returns a new ImmutableList with all elements of the collection that return true when evaluating the specified predicate which is supplied each element and its relative index.

public <R extends Collection<T>> R
selectWithIndex(ObjectIntPredicate<? super T> predicate, R target)

Overrides default org.eclipse.collections.api.ordered.OrderedIterable.selectWithIndex.

Adds all elements to the target Collection that return true when evaluating the specified predicate which is supplied each element and its relative index.

public int
public Spliterator<T>
public DoubleSummaryStatistics
summarizeDouble(DoubleFunction<? super T> function)

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

Returns the result of summarizing the value returned from applying the DoubleFunction to each element of the iterable.

public DoubleSummaryStatistics
summarizeFloat(FloatFunction<? super T> function)

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

Returns the result of summarizing the value returned from applying the FloatFunction to each element of the iterable.

public IntSummaryStatistics
summarizeInt(IntFunction<? super T> function)

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

Returns the result of summarizing the value returned from applying the IntFunction to each element of the iterable.

public LongSummaryStatistics
summarizeLong(LongFunction<? super T> function)

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

Returns the result of summarizing the value returned from applying the LongFunction to each element of the iterable.

public double
sumOfDouble(DoubleFunction<? super T> function)

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.sumOfDouble.

Implements org.eclipse.collections.api.RichIterable.sumOfDouble.

Returns the final double result of evaluating function for each element of the iterable and adding the results together.

public double
sumOfFloat(FloatFunction<? super T> function)

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.sumOfFloat.

Implements org.eclipse.collections.api.RichIterable.sumOfFloat.

Returns the final double result of evaluating function for each element of the iterable and adding the results together.

public long
sumOfInt(IntFunction<? super T> function)

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.sumOfInt.

Implements org.eclipse.collections.api.RichIterable.sumOfInt.

Returns the final long result of evaluating function for each element of the iterable and adding the results together.

public long
sumOfLong(LongFunction<? super T> function)

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.sumOfLong.

Implements org.eclipse.collections.api.RichIterable.sumOfLong.

Returns the final long result of evaluating function for each element of the iterable and adding the results together.

public ImmutableList<T>
take(int count)

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.take.

Implements org.eclipse.collections.api.list.ImmutableList.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 ImmutableList<T>
takeWhile(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.list.immutable.AbstractImmutableList.takeWhile.

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

Returns the initial elements that satisfy the Predicate.

public Object[]
toArray()

Overrides org.eclipse.collections.impl.collection.immutable.AbstractImmutableCollection.toArray.

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

Implements java.util.List.toArray, java.util.Collection.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element).

public <E> E[]
toArray(E[] a)

Overrides org.eclipse.collections.impl.collection.immutable.AbstractImmutableCollection.toArray.

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

Implements java.util.List.toArray, java.util.Collection.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array.

public String
toString()

Overrides org.eclipse.collections.impl.AbstractRichIterable.toString.

Implements org.eclipse.collections.api.RichIterable.toString.

Returns a string with the elements of this iterable separated by commas with spaces and enclosed in square brackets.

Inherited from org.eclipse.collections.impl.list.immutable.AbstractImmutableList:
addaddAllasParallelasReversedcastToListchunkcollectBooleancollectBytecollectCharcollectDoublecollectFloatcollectIntcollectLongcollectShortdetectIndexdetectLastIndexdistinctdistinctdistinctByforEachforEachWithgroupBygroupBygroupByEachgroupByEachinjectIntoinjectIntoinjectIntoinjectIntolistIteratorlistIteratormaxmaxminminnewMutablenewWithAllnewWithoutnewWithoutAllregularListEqualsremovereplaceAllsetsortsubListtaptoImmutabletoReversedzipzipWithIndex