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.
| Modifier and Type | Field and Description |
|---|---|
| private static final Object[] | |
| protected transient T[] | |
| private static final int | |
| private static final long | |
| protected int | |
| private static final Object[] |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| protected | |
| protected | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | add(T newItem)
Overrides org. Implements java. Appends the specified element to the end of this list (optional operation). |
| public void | add(int index, T element)
Implements java. Inserts the specified element at the specified position in this list (optional operation). |
| public boolean | addAll(Collection<? extends T> source)
Overrides org. Implements java. 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. Inserts all of the elements in the specified collection into this list at the specified position (optional operation). |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| public boolean | allSatisfy(Predicate<? super T> predicate)
Overrides org. Implements org. 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. Implements org. 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. Implements org. 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. Implements org. 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. Implements org. Prints a string representation of this collection onto the given |
| public void | batchForEach(Procedure<? super T> procedure, int sectionIndex, int sectionCount)
Implements org.
|
| public void | clear()
Overrides org. Implements java. Removes all of the elements from this list (optional operation). |
| public FastList | clone()
Overrides org. Implements org. Creates and returns a copy of this object. |
| public <V> FastList | collect(Function<? super T, ? extends V> function)
Overrides default org. Implements org. Returns a new MutableCollection with the results of applying the specified function to each element of the source collection. |
| public <V, R extends Collection | collect(Function<? super T, ? extends V> function, R target)
Overrides org. Implements org. Same as |
| public <R extends MutableBooleanCollection> R | collectBoolean(BooleanFunction<? super T> booleanFunction, R target)
Overrides default org. Same as |
| public <R extends MutableByteCollection> R | collectByte(ByteFunction<? super T> byteFunction, R target)
Overrides default org. Same as |
| public <R extends MutableCharCollection> R | collectChar(CharFunction<? super T> charFunction, R target)
Overrides default org. Same as |
| public <R extends MutableDoubleCollection> R | collectDouble(DoubleFunction<? super T> doubleFunction, R target)
Overrides default org. Same as |
| public <R extends MutableFloatCollection> R | collectFloat(FloatFunction<? super T> floatFunction, R target)
Overrides default org. Same as |
| public <V> FastList | collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)
Overrides default org. Implements org. 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 | collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function, R target)
Overrides org. Implements org. 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. Same as |
| public <R extends MutableLongCollection> R | collectLong(LongFunction<? super T> longFunction, R target)
Overrides default org. Same as |
| public <R extends MutableShortCollection> R | collectShort(ShortFunction<? super T> shortFunction, R target)
Overrides default org. Same as |
| public <P, V> FastList | collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter)
Overrides default org. Implements org. Same as |
| public <P, V, R extends Collection | collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter, R target)
Overrides org. Implements org. Same as collectWith but with a targetCollection parameter to gather the results. |
| public <V> MutableList | collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function)
Overrides default org. Returns a new OrderedIterable using results obtained by applying the specified function to each element and its corresponding index. |
| public <V, R extends Collection | collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function, R target)
Overrides default org. Adds elements to the target Collection using results obtained by applying the specified function to each element and its corresponding index. |
| private Object[] | |
| public <S> boolean | corresponds(OrderedIterable<S> other, Predicate2<? super T, ? super S> predicate)
Overrides org. Implements org. Returns true if both OrderedIterables have the same length
and |
| public int | count(Predicate<? super T> predicate)
Overrides org. Implements org. 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. Implements org. Returns the total number of elements that evaluate to true for the specified predicate. |
| public T | detect(Predicate<? super T> predicate)
Overrides org. Implements org. 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. Implements org. Returns the index of the first element of the |
| public int | detectLastIndex(Predicate<? super T> predicate)
Overrides org. Implements org. Returns the index of the last element of the |
| private int | |
| public Optional | detectOptional(Predicate<? super T> predicate)
Overrides org. Implements org. 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. Implements org. Returns the first element that evaluates to true for the specified predicate2 and parameter, or null if none evaluate to true. |
| public <P> Optional | detectWithOptional(Predicate2<? super T, ? super P> predicate, P parameter)
Overrides org. Implements org. Returns the first element that evaluates to true for the specified predicate2 and parameter as an Optional. |
| public MutableList | distinct()
Overrides org. Implements org. Returns a new |
| public MutableList | distinct(HashingStrategy<? super T> hashingStrategy)
Overrides org. Implements org. Returns a new |
| public MutableList | drop(int count)
Overrides org. Implements org. Returns an iterable after skipping the first |
| public MutableList | dropWhile(Predicate<? super T> predicate)
Overrides org. Implements org. Returns the final elements that do not satisfy the Predicate. |
| public void | each(Procedure<? super T> procedure)
Overrides org. Implements org. The procedure is executed for each element in the iterable. |
| public void | |
| private void | |
| private int | |
| public boolean | equals(Object that)
Overrides org. Implements java. Compares the specified object with this list for equality. |
| public boolean | |
| public <V> FastList | flatCollect(Function<? super T, ? extends Iterable<V>> function)
Overrides default org. Implements org.
|
| public <V, R extends Collection | flatCollect(Function<? super T, ? extends Iterable<V>> function, R target)
Overrides org. Implements org. 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. 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. 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. 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. 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. 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. 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. 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. 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. Implements org. Iterates over the section of the iterable covered by the specified inclusive indexes. |
| public void | |
| public <P> void | forEachWith(Procedure2<? super T, ? super P> procedure, P parameter)
Overrides org. Implements org. 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. Implements org. Iterates over the section of the iterable covered by the specified inclusive indexes. |
| public void | forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)
Overrides org. Implements org. 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. Returns the element at the specified position in this list. |
| public int | getBatchCount(int batchSize)
Implements org.
|
| public T | getFirst()
Overrides org. Overrides default org. Implements org. This default override exists because java.util.List added a default getFirst() method in Java 21. |
| public T | getLast()
Overrides org. Overrides default org. Implements org. This default override exists because java.util.List added a default getLast() method in Java 21. |
| public <V> FastListMultimap | groupBy(Function<? super T, ? extends V> function)
Overrides org. Implements org. 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 | groupBy(Function<? super T, ? extends V> function, R target)
Overrides org. Implements org. Same as |
| public <V> FastListMultimap | groupByEach(Function<? super T, ? extends Iterable<V>> function)
Overrides org. Implements org. Similar to |
| public <V, R extends MutableMultimap | groupByEach(Function<? super T, ? extends Iterable<V>> function, R target)
Overrides org. Implements org. Same as |
| public <K> MutableMap | groupByUniqueKey(Function<? super T, ? extends K> function)
Overrides org. Overrides default org. Implements org. 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 | groupByUniqueKey(Function<? super T, ? extends K> function, R target)
Overrides org. Implements org. Same as |
| public int | hashCode()
Overrides org. Implements java. Returns the hash code value for this list. |
| public int | indexOf(Object object)
Overrides org. Overrides default org. 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. Implements org. 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. Implements org. 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. Implements org. 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. Implements org. 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. Implements org. 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. Implements org. 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. Implements java. 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. Implements org. Returns the maximum element out of this container based on the comparator. |
| public T | max()
Overrides org. Implements org. Returns the maximum element out of this container based on the natural order. |
| public <V extends Comparable | maxBy(Function<? super T, ? extends V> function)
Overrides org. Implements org. 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. Implements org. Returns the minimum element out of this container based on the comparator. |
| public T | min()
Overrides org. Implements org. Returns the minimum element out of this container based on the natural order. |
| public <V extends Comparable | minBy(Function<? super T, ? extends V> function)
Overrides org. Implements org. 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 | |
| public static <E> FastList | |
| public static <E> FastList | |
| public static <E> FastList | newListWith(E... elements)
Creates a new list using the passed |
| public static <E> FastList | 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. Implements org. 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. Implements org. Returns true if the predicate evaluates to false for every element of the collection, or return false. |
| public PartitionFastList | partition(Predicate<? super T> predicate)
Overrides org. Implements org. Filters a collection into a PartitionedIterable based on the evaluation of the predicate. |
| public PartitionMutableList | partitionWhile(Predicate<? super T> predicate)
Overrides org. Implements org. Returns a Partition of the initial elements that satisfy the Predicate and the remaining elements. |
| public <P> PartitionFastList | partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)
Overrides org. Implements org. Filters a collection into a PartitionIterable based on the evaluation of the predicate. |
| public void | readExternal(ObjectInput in)
Implements java. 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 | reduce(BinaryOperator<T> accumulator)
Overrides org. Overrides default org. This method produces the equivalent result as |
| public <R, A> R | reduceInPlace(Collector<? super T, A, R> collector)
Overrides default org. This method produces the equivalent result as |
| public <R> R | reduceInPlace(Supplier<R> supplier, BiConsumer<R, ? super T> accumulator)
Overrides default org. This method produces the equivalent result as |
| public FastList | reject(Predicate<? super T> predicate)
Overrides default org. Implements org. Returns a MutableCollection with all elements that evaluate to false for the specified predicate. |
| public <R extends Collection | reject(Predicate<? super T> predicate, R target)
Overrides org. Implements org. Same as the reject method with one parameter but uses the specified target collection for the results. |
| public <P> FastList | rejectWith(Predicate2<? super T, ? super P> predicate, P parameter)
Overrides default org. Implements org. Returns a MutableCollection with all elements that evaluate to false for the specified predicate2 and parameter. |
| public <P, R extends Collection | rejectWith(Predicate2<? super T, ? super P> predicate, P parameter, R target)
Overrides org. Implements org. Similar to |
| public MutableList | rejectWithIndex(ObjectIntPredicate<? super T> predicate)
Overrides default org. 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 | rejectWithIndex(ObjectIntPredicate<? super T> predicate, R target)
Overrides default org. 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. Removes the element at the specified position in this list (optional operation). |
| public boolean | remove(Object object)
Overrides org. Implements java. 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. Implements org. 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. Implements org. 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. Removes from this list all the elements whose index is between
|
| public void | replaceAll(UnaryOperator<T> operator)
Overrides default java. Replaces each element of this list with the result of applying the operator to that element (optional operation). |
| public FastList | reverseThis()
Overrides default org. Mutates this list by reversing its order and returns the current list as a result. |
| public FastList | select(Predicate<? super T> predicate)
Overrides default org. Implements org. Returns a MutableCollection with all elements that evaluate to true for the specified predicate. |
| public <R extends Collection | select(Predicate<? super T> predicate, R target)
Overrides org. Implements org. Same as the select method with one parameter but uses the specified target collection for the results. |
| public <P> Twin | selectAndRejectWith(Predicate2<? super T, ? super P> predicate, P parameter)
Overrides org. Implements org. Filters a collection into two separate collections based on a predicate returned via a Pair. |
| public <S> FastList | selectInstancesOf(Class<S> clazz)
Overrides org. Implements org. Returns all elements of the source collection that are instances of the Class |
| public <P> FastList | selectWith(Predicate2<? super T, ? super P> predicate, P parameter)
Overrides default org. Implements org. Returns a MutableCollection with all elements that evaluate to true for the specified predicate2 and parameter. |
| public <P, R extends Collection | selectWith(Predicate2<? super T, ? super P> predicate, P parameter, R target)
Overrides org. Implements org. Similar to |
| public MutableList | selectWithIndex(ObjectIntPredicate<? super T> predicate)
Overrides default org. 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 | selectWithIndex(ObjectIntPredicate<? super T> predicate, R target)
Overrides default org. 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. Replaces the element at the specified position in this list with the specified element (optional operation). |
| private void | |
| public int | size()
Implements org. Returns the number of elements in this list. |
| private int | |
| public void | sort(Comparator<? super T> comparator)
Overrides default java. Overrides default method from List. |
| public FastList | sortThis(Comparator<? super T> comparator)
Overrides default org. Sorts the internal data structure of this list and returns the list itself as a convenience. |
| public FastList | sortThis()
Overrides default org. Sorts the internal data structure of this list and returns the list itself as a convenience. |
| public Spliterator | spliterator()
Overrides default java. Creates a |
| public <V> MutableObjectDoubleMap | sumByDouble(Function<? super T, ? extends V> groupBy, DoubleFunction<? super T> function)
Overrides org. Implements org. Groups and sums the values using the two specified functions. |
| public <V> MutableObjectDoubleMap | sumByFloat(Function<? super T, ? extends V> groupBy, FloatFunction<? super T> function)
Overrides org. Implements org. Groups and sums the values using the two specified functions. |
| public <V> MutableObjectLongMap | sumByInt(Function<? super T, ? extends V> groupBy, IntFunction<? super T> function)
Overrides org. Implements org. Groups and sums the values using the two specified functions. |
| public <V> MutableObjectLongMap | sumByLong(Function<? super T, ? extends V> groupBy, LongFunction<? super T> function)
Overrides org. Implements org. Groups and sums the values using the two specified functions. |
| public DoubleSummaryStatistics | summarizeDouble(DoubleFunction<? super T> function)
Overrides default org. 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. 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. 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. 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. Implements org. 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. Implements org. 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. Implements org. 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. Implements org. Returns the final long result of evaluating function for each element of the iterable and adding the results together. |
| public MutableList | take(int count)
Overrides org. Implements org. Returns the first |
| public MutableList | takeWhile(Predicate<? super T> predicate)
Overrides org. Implements org. Returns the initial elements that satisfy the Predicate. |
| private void | |
| public <E> E[] | |
| public <E> E[] | |
| public <E> E[] | toArray(E[] array)
Overrides default org. 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. Returns an array containing all of the elements in this list in proper sequence (from first to last element). |
| public FastList | toList()
Overrides org. Implements org. Converts the collection to a MutableList implementation. |
| public FastList | toSortedList()
Overrides org. Overrides default org. Converts the collection to a MutableList implementation and sorts it using the natural order of the elements. |
| public FastList | toSortedList(Comparator<? super T> comparator)
Overrides default org. Converts the collection to a MutableList implementation and sorts it using the specified comparator. |
| public T[] | |
| 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 | |
| public FastList | |
| public FastList | |
| public FastList | with(T... elements)
Overrides default org. Implements org. This method allows mutable and fixed size collections the ability to add elements to their existing elements. |
| public FastList | |
| public static <E> FastList | |
| public void | writeExternal(ObjectOutput out)
Implements java. 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. |