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

public Class FastList<T>

extends AbstractMutableList<T>
implements Externalizable, RandomAccess, BatchIterable<T>
Class Inheritance
All Implemented Interfaces
org.eclipse.collections.impl.parallel.BatchIterable, java.util.RandomAccess, java.io.Externalizable, java.io.Serializable
Imports
java.io.Externalizable, .IOException, .ObjectInput, .ObjectOutput, java.lang.reflect.Array, java.util.ArrayList, .Arrays, .Collection, .Comparator, .DoubleSummaryStatistics, .IntSummaryStatistics, .List, .LongSummaryStatistics, .Objects, .Optional, .RandomAccess, .Spliterator, .Spliterators, java.util.function.BiConsumer, .BinaryOperator, .Supplier, .UnaryOperator, java.util.stream.Collector, org.eclipse.collections.api.BooleanIterable, .ByteIterable, .CharIterable, .DoubleIterable, .FloatIterable, .IntIterable, .LongIterable, .ShortIterable, org.eclipse.collections.api.block.HashingStrategy, org.eclipse.collections.api.block.function.Function, .Function0, .Function2, .Function3, org.eclipse.collections.api.block.function.primitive.BooleanFunction, .ByteFunction, .CharFunction, .DoubleFunction, .DoubleObjectToDoubleFunction, .FloatFunction, .FloatObjectToFloatFunction, .IntFunction, .IntObjectToIntFunction, .LongFunction, .LongObjectToLongFunction, .ObjectIntToObjectFunction, .ShortFunction, org.eclipse.collections.api.block.predicate.Predicate, .Predicate2, org.eclipse.collections.api.block.predicate.primitive.ObjectIntPredicate, org.eclipse.collections.api.block.procedure.Procedure, .Procedure2, org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure, org.eclipse.collections.api.collection.primitive.MutableBooleanCollection, .MutableByteCollection, .MutableCharCollection, .MutableDoubleCollection, .MutableFloatCollection, .MutableIntCollection, .MutableLongCollection, .MutableShortCollection, org.eclipse.collections.api.list.MutableList, org.eclipse.collections.api.map.MutableMap, .MutableMapIterable, org.eclipse.collections.api.map.primitive.MutableObjectDoubleMap, .MutableObjectLongMap, org.eclipse.collections.api.multimap.MutableMultimap, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.partition.list.PartitionMutableList, org.eclipse.collections.api.tuple.Twin, org.eclipse.collections.impl.block.factory.Comparators, .Procedures2, org.eclipse.collections.impl.map.mutable.UnifiedMap, org.eclipse.collections.impl.multimap.list.FastListMultimap, org.eclipse.collections.impl.parallel.BatchIterable, org.eclipse.collections.impl.partition.list.PartitionFastList, org.eclipse.collections.impl.utility.ArrayIterate, .ArrayListIterate, .Iterate, .ListIterate, org.eclipse.collections.impl.utility.internal.InternalArrayIterate, .RandomAccessListIterate

FastList is an attempt to provide the same functionality as ArrayList without the support for concurrent modification exceptions. It also attempts to correct the problem with subclassing ArrayList in that the data elements are protected, not private. It is this issue that caused this class to be created in the first place. The intent was to provide optimized internal iterators which use direct access against the array of items, which is currently not possible by subclassing ArrayList.

An empty FastList created by calling the default constructor starts with a shared reference to a static empty array (DEFAULT_SIZED_EMPTY_ARRAY). This makes empty FastLists very memory efficient. The first call to add will lazily create an array of size 10.

An empty FastList created by calling the pre-size constructor with a value of 0 (new FastList(0)) starts with a shared reference to a static empty array (ZERO_SIZED_ARRAY). This makes FastLists presized to 0 very memory efficient as well. The first call to add will lazily create an array of size 1.

Field Summary

Modifier and TypeField and Description
private static final Object[]
protected transient T[]
private static final int
private static final long
protected int
private static final Object[]

Constructor Summary

AccessConstructor and Description
public
public
FastList(int initialCapacity)

protected
FastList(T[] array)

protected
FastList(int size, T[] array)

public
FastList(Collection<? extends T> source)

Method Summary

Modifier and TypeMethod and Description
public boolean
add(T newItem)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection.add.

Implements java.util.Collection.add, java.util.List.add.

Appends the specified element to the end of this list (optional operation).

public void
add(int index, T element)

Implements java.util.List.add.

Inserts the specified element at the specified position in this list (optional operation).

public boolean
addAll(Collection<? extends T> source)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection.addAll.

Implements java.util.Collection.addAll, java.util.List.addAll.

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation).

public boolean
addAll(int index, Collection<? extends T> source)

Implements java.util.List.addAll.

Inserts all of the elements in the specified collection into this list at the specified position (optional operation).

private void
private void
addAllArrayListAtIndex(ArrayList<T> source, int index)

private void
addAllCollection(Collection<? extends T> source)

private void
addAllCollectionAtIndex(Collection<? extends T> source, int index)

private void
private void
addAllFastListAtIndex(FastList<T> source, int index)

private void
private void
addAllRandomAccessListAtIndex(List<T> source, int index)

private void
addAtIndex(int index, T element)

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

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.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 <P> boolean
allSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.allSatisfyWith.

Implements org.eclipse.collections.api.RichIterable.allSatisfyWith.

Returns true if the predicate evaluates to true for every element of the collection, or returns false.

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

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.anySatisfy.

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

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

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

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.anySatisfyWith.

Implements org.eclipse.collections.api.RichIterable.anySatisfyWith.

Returns true if the predicate evaluates to true for any element of the collection, or return false.

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

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.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 void
clear()

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.clear.

Implements java.util.Collection.clear, java.util.List.clear.

Removes all of the elements from this list (optional operation).

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

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

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

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

public <V, R extends Collection<V>> R
collect(Function<? super T, ? extends V> function, R target)

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

Implements org.eclipse.collections.api.RichIterable.collect.

Same as collect(Function), except that the results are gathered into the specified target collection.

public <R extends MutableBooleanCollection> R
collectBoolean(BooleanFunction<? super T> booleanFunction, R target)

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

Same as collectBoolean(BooleanFunction), except that the results are gathered into the specified target collection.

public <R extends MutableByteCollection> R
collectByte(ByteFunction<? super T> byteFunction, R target)

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

Same as collectByte(ByteFunction), except that the results are gathered into the specified target collection.

public <R extends MutableCharCollection> R
collectChar(CharFunction<? super T> charFunction, R target)

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

Same as collectChar(CharFunction), except that the results are gathered into the specified target collection.

public <R extends MutableDoubleCollection> R
collectDouble(DoubleFunction<? super T> doubleFunction, R target)

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

Same as collectDouble(DoubleFunction), except that the results are gathered into the specified target collection.

public <R extends MutableFloatCollection> R
collectFloat(FloatFunction<? super T> floatFunction, R target)

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

Same as collectFloat(FloatFunction), except that the results are gathered into the specified target collection.

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

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

Implements org.eclipse.collections.api.collection.MutableCollection.collectIf, org.eclipse.collections.api.RichIterable.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 <V, R extends Collection<V>> R
collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function, R target)

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

Implements org.eclipse.collections.api.RichIterable.collectIf.

Same as the collectIf method with two parameters but uses the specified target collection for the results.

public <R extends MutableIntCollection> R
collectInt(IntFunction<? super T> intFunction, R target)

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

Same as collectInt(IntFunction), except that the results are gathered into the specified target collection.

public <R extends MutableLongCollection> R
collectLong(LongFunction<? super T> longFunction, R target)

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

Same as collectLong(LongFunction), except that the results are gathered into the specified target collection.

public <R extends MutableShortCollection> R
collectShort(ShortFunction<? super T> shortFunction, R target)

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

Same as collectShort(ShortFunction), except that the results are gathered into the specified target collection.

public <P, V> FastList<V>
collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter)

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

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

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

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.mutable.AbstractMutableList.collectWith.

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

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

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

Overrides default org.eclipse.collections.api.list.MutableList.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.

private Object[]
copyItemsWithNewCapacity(int newCapacity)

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

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.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.mutable.AbstractMutableList.count.

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

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

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

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.countWith.

Implements org.eclipse.collections.api.RichIterable.countWith.

Returns the total number of elements that evaluate to true for the specified predicate.

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

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.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 int
detectIndex(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.detectIndex.

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)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.detectLastIndex.

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.

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

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

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.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.list.mutable.AbstractMutableList.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.list.mutable.AbstractMutableList.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 MutableList<T>
distinct()

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.distinct.

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

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

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

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.distinct.

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

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

public MutableList<T>
drop(int count)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.drop.

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)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.dropWhile.

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.list.mutable.AbstractMutableList.each.

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

The procedure is executed for each element in the iterable.

public void
ensureCapacity(int minCapacity)

private void
private int
public boolean
public boolean
public <V> FastList<V>
public <V, R extends Collection<V>> R
flatCollect(Function<? super T, ? extends Iterable<V>> function, R target)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.flatCollect.

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

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

public <R extends MutableBooleanCollection> R
flatCollectBoolean(Function<? super T, ? extends BooleanIterable> function, R target)

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

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

public <R extends MutableByteCollection> R
flatCollectByte(Function<? super T, ? extends ByteIterable> function, R target)

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

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

public <R extends MutableCharCollection> R
flatCollectChar(Function<? super T, ? extends CharIterable> function, R target)

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

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

public <R extends MutableDoubleCollection> R
flatCollectDouble(Function<? super T, ? extends DoubleIterable> function, R target)

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

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

public <R extends MutableFloatCollection> R
flatCollectFloat(Function<? super T, ? extends FloatIterable> function, R target)

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

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

public <R extends MutableIntCollection> R
flatCollectInt(Function<? super T, ? extends IntIterable> function, R target)

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

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

public <R extends MutableLongCollection> R
flatCollectLong(Function<? super T, ? extends LongIterable> function, R target)

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

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

public <R extends MutableShortCollection> R
flatCollectShort(Function<? super T, ? extends ShortIterable> function, R target)

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

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

public void
forEach(int from, int to, Procedure<? super T> procedure)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.forEach.

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

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

public void
forEachIf(Predicate<? super T> predicate, Procedure<? super T> procedure)

public <P> void
forEachWith(Procedure2<? super T, ? super P> procedure, P parameter)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.forEachWith.

Implements org.eclipse.collections.api.InternalIterable.forEachWith.

The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.

public void
forEachWithIndex(int from, int to, ObjectIntProcedure<? super T> objectIntProcedure)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.forEachWithIndex.

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

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.list.mutable.AbstractMutableList.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 T
get(int index)

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

Returns the element at the specified position in this list.

public int
public T
getFirst()

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.getFirst.

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

Implements org.eclipse.collections.api.RichIterable.getFirst.

This default override exists because java.util.List added a default getFirst() method in Java 21.

public T
getLast()

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.getLast.

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

Implements org.eclipse.collections.api.RichIterable.getLast.

This default override exists because java.util.List added a default getLast() method in Java 21.

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

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

Implements org.eclipse.collections.api.list.MutableList.groupBy, org.eclipse.collections.api.collection.MutableCollection.groupBy, org.eclipse.collections.api.RichIterable.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, R extends MutableMultimap<V, T>> R
groupBy(Function<? super T, ? extends V> function, R target)

Overrides org.eclipse.collections.impl.AbstractRichIterable.groupBy.

Implements org.eclipse.collections.api.RichIterable.groupBy.

Same as groupBy(Function), except that the results are gathered into the specified target multimap.

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

Overrides org.eclipse.collections.impl.AbstractRichIterable.groupByEach.

Implements org.eclipse.collections.api.RichIterable.groupByEach.

Same as groupByEach(Function), except that the results are gathered into the specified target multimap.

public <K> MutableMap<K, T>
groupByUniqueKey(Function<? super T, ? extends K> function)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.groupByUniqueKey.

Overrides default org.eclipse.collections.api.collection.MutableCollection.groupByUniqueKey.

Implements org.eclipse.collections.api.RichIterable.groupByUniqueKey.

For each element of the iterable, the function is evaluated, and the results of these evaluations are collected into a new map, where the transformed value is the key.

public <K, R extends MutableMapIterable<K, T>> R
groupByUniqueKey(Function<? super T, ? extends K> function, R target)

Overrides org.eclipse.collections.impl.AbstractRichIterable.groupByUniqueKey.

Implements org.eclipse.collections.api.RichIterable.groupByUniqueKey.

Same as groupByUniqueKey(Function), except that the results are gathered into the specified target map.

public int
public int
indexOf(Object object)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.indexOf.

Overrides default org.eclipse.collections.api.list.MutableList.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.mutable.AbstractMutableList.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 int
injectInto(int injectedValue, IntObjectToIntFunction<? super T> function)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.injectInto.

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

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

public long
injectInto(long injectedValue, LongObjectToLongFunction<? super T> function)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.injectInto.

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

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

public double
injectInto(double injectedValue, DoubleObjectToDoubleFunction<? super T> function)

Overrides org.eclipse.collections.impl.AbstractRichIterable.injectInto.

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

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

public float
injectInto(float injectedValue, FloatObjectToFloatFunction<? super T> function)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.injectInto.

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

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

public <IV, P> IV
injectIntoWith(IV injectValue, Function3<? super IV, ? super T, ? super P, ? extends IV> function, P parameter)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.injectIntoWith.

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

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

public int
lastIndexOf(Object object)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.lastIndexOf.

Implements java.util.List.lastIndexOf, org.eclipse.collections.api.list.ListIterable.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 T
max(Comparator<? super T> comparator)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.max.

Implements org.eclipse.collections.api.RichIterable.max.

Returns the maximum element out of this container based on the comparator.

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

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.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 T
min(Comparator<? super T> comparator)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.min.

Implements org.eclipse.collections.api.RichIterable.min.

Returns the minimum element out of this container based on the comparator.

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

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.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.

private IndexOutOfBoundsException
public static <E> FastList<E>
public static <E> FastList<E>
newList(int initialCapacity)

public static <E> FastList<E>
newList(Iterable<? extends E> source)

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

Creates a new list using the passed elements argument as the backing store.

public static <E> FastList<E>
newWithNValues(int size, Function0<? extends E> factory)

Creates a new FastList pre-sized to the specified size filled with default values generated by the specified function.

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

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.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 <P> boolean
noneSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.noneSatisfyWith.

Implements org.eclipse.collections.api.RichIterable.noneSatisfyWith.

Returns true if the predicate evaluates to false for every element of the collection, or return false.

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

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.partitionWhile.

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> PartitionFastList<T>
public void
readExternal(ObjectInput in)

Implements java.io.Externalizable.readExternal.

The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.

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 FastList<T>
reject(Predicate<? super T> predicate)

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

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

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

public <R extends Collection<T>> R
reject(Predicate<? super T> predicate, R target)

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

Implements org.eclipse.collections.api.RichIterable.reject.

Same as the reject method with one parameter but uses the specified target collection for the results.

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

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

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

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

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

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.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 MutableList<T>
rejectWithIndex(ObjectIntPredicate<? super T> predicate)

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

Returns a new MutableList 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 T
remove(int index)

Implements java.util.List.remove.

Removes the element at the specified position in this list (optional operation).

public boolean
remove(Object object)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection.remove.

Implements java.util.Collection.remove, java.util.List.remove.

Removes the first occurrence of the specified element from this list, if it is present (optional operation).

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

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.removeIf.

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

Removes all elements in the collection that evaluate to true for the specified predicate.

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

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.removeIfWith.

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

Removes all elements in the collection that evaluate to true for the specified predicate2 and parameter.

public void
removeRange(int
inclusive
fromIndex
,
int
exclusive
toIndex
)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.removeRange.

Removes from this list all the elements whose index is between fromIndex, inclusive, and toIndex, exclusive.

public void
replaceAll(UnaryOperator<T> operator)

Overrides default java.util.List.replaceAll.

Replaces each element of this list with the result of applying the operator to that element (optional operation).

public FastList<T>
reverseThis()

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

Mutates this list by reversing its order and returns the current list as a result.

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

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

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

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

public <R extends Collection<T>> R
select(Predicate<? super T> predicate, R target)

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

Implements org.eclipse.collections.api.RichIterable.select.

Same as the select method with one parameter but uses the specified target collection for the results.

public <P> Twin<MutableList<T>>
selectAndRejectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.selectAndRejectWith.

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

Filters a collection into two separate collections based on a predicate returned via a Pair.

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

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

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

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

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

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.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 MutableList<T>
selectWithIndex(ObjectIntPredicate<? super T> predicate)

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

Returns a new MutableList 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 T
set(int index, T element)

Implements java.util.List.set.

Replaces the element at the specified position in this list with the specified element (optional operation).

private void
shiftElementsAtIndex(int index, int sourceSize)

public int
private int
sizePlusFiftyPercent(int oldSize)

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

Overrides default java.util.List.sort.

Overrides default method from List.

public FastList<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 FastList<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 Spliterator<T>
public <V> MutableObjectDoubleMap<V>
public <V> MutableObjectDoubleMap<V>
public <V> MutableObjectLongMap<V>
public <V> MutableObjectLongMap<V>
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.mutable.AbstractMutableList.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.mutable.AbstractMutableList.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.mutable.AbstractMutableList.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.mutable.AbstractMutableList.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 MutableList<T>
take(int count)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.take.

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)

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.takeWhile.

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

Returns the initial elements that satisfy the Predicate.

private void
throwOutOfBounds(int index)

public <E> E[]
toArray(E[] array, int sourceFromIndex, int sourceToIndex, int destinationIndex)

public <E> E[]
toArray(int sourceFromIndex, int sourceToIndex)

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

Overrides default org.eclipse.collections.api.list.MutableList.toArray, org.eclipse.collections.api.collection.MutableCollection.toArray, org.eclipse.collections.api.RichIterable.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 Object[]
toArray()

Overrides default org.eclipse.collections.api.list.MutableList.toArray, org.eclipse.collections.api.collection.MutableCollection.toArray, org.eclipse.collections.api.RichIterable.toArray.

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

public FastList<T>
toList()

Overrides org.eclipse.collections.impl.AbstractRichIterable.toList.

Implements org.eclipse.collections.api.RichIterable.toList.

Converts the collection to a MutableList implementation.

public FastList<T>
toSortedList()

Overrides org.eclipse.collections.impl.list.mutable.AbstractMutableList.toSortedList.

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

Converts the collection to a MutableList implementation and sorts it using the natural order of the elements.

public FastList<T>
toSortedList(Comparator<? super T> comparator)

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

Converts the collection to a MutableList implementation and sorts it using the specified comparator.

public T[]
toTypedArray(Class<T> clazz)

private void
public void
public boolean
trimToSizeIfGreaterThanPercent(double loadFactor)

Express load factor as 0.25 to trim a collection with more than 25% excess capacity

private void
wipeAndResetTheEnd(int newCurrentFilledIndex)

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

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

public FastList<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 FastList<T>
withArrayCopy(T[] elements, int begin, int length)

public static <E> FastList<E>
wrapCopy(E... array)

public void
writeExternal(ObjectOutput out)

Implements java.io.Externalizable.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Inherited from org.eclipse.collections.impl.list.mutable.AbstractMutableList:
appendStringasParallelasReversedasSynchronizedasUnmodifiablebinarySearchchunkcontainscontainsAlldistinctByiteratorlistIteratorlistIteratornewEmptyremoveAllretainAllsortThisByBooleansortThisByBytesortThisByCharsortThisByDoublesortThisByFloatsortThisByIntsortThisByLongsortThisByShortsubListsubListRangeChecktaptoSetzipzipzipWithIndexzipWithIndex