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

public final Class ListAdapter<T>

extends AbstractListAdapter<T>
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.Serializable, java.util.ArrayList, .Comparator, .List, .RandomAccess, java.util.concurrent.ExecutorService, org.eclipse.collections.api.block.HashingStrategy, org.eclipse.collections.api.block.function.Function0, .Function2, org.eclipse.collections.api.block.predicate.Predicate, .Predicate2, org.eclipse.collections.api.block.procedure.Procedure, org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure, org.eclipse.collections.api.factory.Lists, org.eclipse.collections.api.list.ImmutableList, .MutableList, .ParallelListIterable, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.partition.list.PartitionMutableList, org.eclipse.collections.impl.block.procedure.CollectionAddProcedure, org.eclipse.collections.impl.lazy.parallel.list.NonParallelListIterable, org.eclipse.collections.impl.utility.ArrayIterate, .ListIterate, .OrderedIterate

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

To create a new wrapper around an existing List instance, use the adapt(List) factory method.

Field Summary

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

Constructor Summary

AccessConstructor and Description
pack-priv
ListAdapter(List<T> newDelegate)

Method Summary

Modifier and TypeMethod and Description
public static <E> MutableList<E>
adapt(List<E> list)

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

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

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

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

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

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

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

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

public ParallelListIterable<T>
asParallel(ExecutorService executorService, int batchSize)

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

Implements org.eclipse.collections.api.list.ListIterable.asParallel.

Returns a parallel iterable of this ListIterable.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

public MutableList<T>
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)

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)

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

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

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

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

Returns the final elements that do not satisfy the Predicate.

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

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

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

The procedure is executed for each element in the iterable.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

public MutableList<T>
newEmpty()

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

Deprecated use FastList#newList() instead (inlineable)

Creates a new empty mutable version of the same collection type.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Overrides default java.util.List.sort.

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

public ListAdapter<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 ListAdapter<T>
sortThis()

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

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

public MutableList<T>
take(int count)

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

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

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

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

Returns the initial elements that satisfy the Predicate.

public ImmutableList<T>
public ListAdapter<T>
with(T element)

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

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

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

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

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

public ListAdapter<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 ListAdapter<T>
withAll(Iterable<? extends T> elements)

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

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

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

public ListAdapter<T>
without(T element)

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

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

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

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

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

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

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

Inherited from org.eclipse.collections.impl.list.mutable.AbstractListAdapter:
addaddAllasReversedcollectcollectIfcollectWithdistinctByequalsflatCollectgetgroupBygroupByEachhashCodeindexOflastIndexOflistIteratorlistIteratorpartitionpartitionWithrejectrejectWithremoveselectselectWithsetsortThisByBooleansortThisByBytesortThisByCharsortThisByDoublesortThisByFloatsortThisByIntsortThisByLongsortThisByShortsubListtaptoStackzipzipWithIndex

Field Detail

delegateback to summary
private final List<T> delegate
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

ListAdapterback to summary
pack-priv ListAdapter(List<T> newDelegate)

Method Detail

adaptback to summary
public static <E> MutableList<E> adapt(List<E> list)
allSatisfyback to summary
public boolean allSatisfy(Predicate<? super T> predicate)

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

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

Doc from 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. Otherwise, returns false.

Annotations
@Override
anySatisfyback to summary
public boolean anySatisfy(Predicate<? super T> predicate)

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

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

Doc from org.eclipse.collections.api.RichIterable.anySatisfy.

Returns true if the predicate evaluates to true for any element of the iterable. Returns false if the iterable is empty, or if no element returned true when evaluating the predicate.

Annotations
@Override
asParallelback to summary
public ParallelListIterable<T> asParallel(ExecutorService executorService, int batchSize)

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

Implements org.eclipse.collections.api.list.ListIterable.asParallel.

Doc from org.eclipse.collections.api.list.ListIterable.asParallel.

Returns a parallel iterable of this ListIterable.

Annotations
@Override
asSynchronizedback to summary
public MutableList<T> asSynchronized()

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

Doc from org.eclipse.collections.api.collection.MutableCollection.asSynchronized.

Returns a synchronized wrapper backed by this collection. This is the equivalent of using Collections.synchronizedCollection(this) only with a return type that supports the full iteration protocols available on MutableCollection. The preferred way of iterating over a synchronized collection is to use the internal iteration methods which are properly synchronized internally.

 MutableCollection synchedCollection = collection.asSynchronized();
    ...
 synchedCollection.forEach(each -> ... );
 synchedCollection.select(each -> ... );
 synchedCollection.collect(each -> ... );
If you want to iterate using an imperative style, you must protect external iterators using a synchronized block. This includes explicit iterators as well as JDK 5 style for loops.

Annotations
@Override
asUnmodifiableback to summary
public MutableList<T> asUnmodifiable()

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

Doc from org.eclipse.collections.api.list.MutableList.asUnmodifiable.

Returns an unmodifiable view of the list.

Annotations
@Override
cloneback to summary
public MutableList<T> clone()

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

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

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Annotations
@Override
correspondsback to summary
public <S> boolean corresponds(OrderedIterable<S> other, Predicate2<? super T, ? super S> predicate)

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

Doc from 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. The predicate is evaluated for each element at the same position of each OrderedIterable in a forward iteration order. This is a short circuit pattern.

Annotations
@Override
countback to summary
public int count(Predicate<? super T> predicate)

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

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

Doc from org.eclipse.collections.api.RichIterable.count.

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

Example using a Java 8 lambda expression:

int count =
    people.count(person -> person.getAddress().getState().getName().equals("New York"));
Annotations
@Override
detectback to summary
public T detect(Predicate<? super T> predicate)

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

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

Doc from 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. This method is commonly called find.

Example using a Java 8 lambda expression:

Person person =
    people.detect(person -> person.getFirstName().equals("John") && person.getLastName().equals("Smith"));
Annotations
@Override
detectIfNoneback to summary
public T detectIfNone(Predicate<? super T> predicate, Function0<? extends T> function)

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

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

Doc from org.eclipse.collections.api.RichIterable.detectIfNone.

Returns the first element of the iterable for which the predicate evaluates to true. If no element matches the predicate, then returns the value of applying the specified function.

Annotations
@Override
detectIndexback to summary
public int detectIndex(Predicate<? super T> predicate)

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

Doc from org.eclipse.collections.api.ordered.OrderedIterable.detectIndex.

Returns the index of the first element of the OrderedIterable for which the predicate evaluates to true. Returns -1 if no element evaluates true for the predicate.

Annotations
@Override
detectLastIndexback to summary
public int detectLastIndex(Predicate<? super T> predicate)

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

Doc from org.eclipse.collections.api.ordered.ReversibleIterable.detectLastIndex.

Returns the index of the last element of the ReversibleIterable for which the predicate evaluates to true. Returns -1 if no element evaluates true for the predicate.

Annotations
@Override
distinctback to summary
public MutableList<T> distinct()

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

Doc from org.eclipse.collections.api.list.MutableList.distinct.

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

Annotations
@Override
distinctback to summary
public MutableList<T> distinct(HashingStrategy<? super T> hashingStrategy)

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

Doc from org.eclipse.collections.api.list.MutableList.distinct.

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

Annotations
@Override
dropback to summary
public MutableList<T> drop(int count)

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

Doc from org.eclipse.collections.api.ordered.ReversibleIterable.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.

Annotations
@Override
dropWhileback to summary
public MutableList<T> dropWhile(Predicate<? super T> predicate)

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

Doc from org.eclipse.collections.api.list.ListIterable.dropWhile.

Returns the final elements that do not satisfy the Predicate. Short circuits at the first element which does satisfy the Predicate.

Annotations
@Override
eachback to summary
public void each(Procedure<? super T> procedure)

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

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

Doc from org.eclipse.collections.api.RichIterable.each.

The procedure is executed for each element in the iterable.

Example using a Java 8 lambda expression:

people.each(person -> LOGGER.info(person.getName()));
This method is a variant of InternalIterable#forEach(Procedure) that has a signature conflict with Iterable#forEach(java.util.function.Consumer).
Annotations
@Override
forEachback to summary
public void forEach(int fromIndex, int toIndex, Procedure<? super T> procedure)

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

Doc from org.eclipse.collections.api.ordered.OrderedIterable.forEach.

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

e.g.
OrderedIterable<Person> people = FastList.newListWith(ted, mary, bob, sally)
people.forEach(0, 1, person -> LOGGER.info(person.getName()));

This code would output ted and mary's names.

Annotations
@Override
forEachWithIndexback to summary
public void forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)

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

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

Doc from org.eclipse.collections.api.InternalIterable.forEachWithIndex.

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

Example using a Java 8 lambda:

people.forEachWithIndex((Person person, int index) -> LOGGER.info("Index: " + index + " person: " + person.getName()));

Example using an anonymous inner class:

people.forEachWithIndex(new ObjectIntProcedure<Person>()
{
    public void value(Person person, int index)
    {
        LOGGER.info("Index: " + index + " person: " + person.getName());
    }
});
Annotations
@Override
forEachWithIndexback to summary
public void forEachWithIndex(int fromIndex, int toIndex, ObjectIntProcedure<? super T> objectIntProcedure)

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

Doc from org.eclipse.collections.api.ordered.OrderedIterable.forEachWithIndex.

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

e.g.
OrderedIterable<People> people = FastList.newListWith(ted, mary, bob, sally)
people.forEachWithIndex(0, 1, (person, index) -> LOGGER.info(person.getName()));

This code would output ted and mary's names.

Annotations
@Override
getDelegateback to summary
protected List<T> getDelegate()

Implements abstract org.eclipse.collections.impl.list.mutable.AbstractListAdapter.getDelegate.

Annotations
@Override
injectIntoback to summary
public <IV> IV injectInto(IV injectedValue, Function2<? super IV, ? super T, ? extends IV> function)

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

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

Doc from 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. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter. This method is commonly called fold or sometimes reduce.

Annotations
@Override
newEmptyback to summary
public MutableList<T> newEmpty()

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

Doc from org.eclipse.collections.api.collection.MutableCollection.newEmpty.

Deprecated

use FastList#newList() instead (inlineable)

Creates a new empty mutable version of the same collection type. For example, if this instance is a FastList, this method will return a new empty FastList. If the class of this instance is immutable or fixed size (i.e. SingletonList) then a mutable alternative to the class will be provided.

Annotations
@Override
@Deprecated
noneSatisfyback to summary
public boolean noneSatisfy(Predicate<? super T> predicate)

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

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

Doc from 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. Otherwise, returns false.

Annotations
@Override
partitionWhileback to summary
public PartitionMutableList<T> partitionWhile(Predicate<? super T> predicate)

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

Doc from org.eclipse.collections.api.list.ListIterable.partitionWhile.

Returns a Partition of the initial elements that satisfy the Predicate and the remaining elements. Short circuits at the first element which does satisfy the Predicate.

Annotations
@Override
reverseForEachback to summary
public void reverseForEach(Procedure<? super T> procedure)

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

Doc from org.eclipse.collections.api.ordered.ReversibleIterable.reverseForEach.

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

e.g.
people.reverseForEach(person -> LOGGER.info(person.getName()));
Annotations
@Override
reverseForEachWithIndexback to summary
public void reverseForEachWithIndex(ObjectIntProcedure<? super T> procedure)

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

Doc from org.eclipse.collections.api.ordered.ReversibleIterable.reverseForEachWithIndex.

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

e.g.
people.reverseForEachWithIndex((person, index) ->
        LOGGER.info("Index: " + index + " person: " + person.getName()));
Annotations
@Override
selectInstancesOfback to summary
public <S> MutableList<S> selectInstancesOf(Class<S> clazz)

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

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

Doc from org.eclipse.collections.api.collection.MutableCollection.selectInstancesOf.

Returns all elements of the source collection that are instances of the Class clazz.

RichIterable<Integer> integers =
    List.mutable.with(new Integer(0), new Long(0L), new Double(0.0)).selectInstancesOf(Integer.class);
Co-variant example for MutableCollection:
MutableCollection<Integer> integers =
    List.mutable.with(new Integer(0), new Long(0L), new Double(0.0)).selectInstancesOf(Integer.class);
Annotations
@Override
sortback to summary
public void sort(Comparator<? super T> comparator)

Overrides default java.util.List.sort.

Doc from java.util.List.sort.

Sorts this list according to the order induced by the specified Comparator (optional operation). The sort is stable: this method must not reorder equal elements.

All elements in this list must be mutually comparable using the specified comparator (that is, c.compare(e1, e2) must not throw a ClassCastException for any elements e1 and e2 in the list).

If the specified comparator is null then all elements in this list must implement the Comparable interface and the elements' natural ordering should be used.

This list must be modifiable, but need not be resizable.

Annotations
@Override
Since
10.0
sortThisback to summary
public ListAdapter<T> sortThis(Comparator<? super T> comparator)

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

Doc from org.eclipse.collections.api.list.MutableList.sortThis.

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

Annotations
@Override
Since
10.0
sortThisback to summary
public ListAdapter<T> sortThis()

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

Doc from org.eclipse.collections.api.list.MutableList.sortThis.

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

Annotations
@Override
Since
10.0
takeback to summary
public MutableList<T> take(int count)

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

Doc from org.eclipse.collections.api.ordered.ReversibleIterable.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.

Annotations
@Override
takeWhileback to summary
public MutableList<T> takeWhile(Predicate<? super T> predicate)

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

Doc from org.eclipse.collections.api.list.ListIterable.takeWhile.

Returns the initial elements that satisfy the Predicate. Short circuits at the first element which does not satisfy the Predicate.

Annotations
@Override
toImmutableback to summary
public ImmutableList<T> toImmutable()

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

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

Doc from org.eclipse.collections.api.list.MutableList.toImmutable.

Returns an immutable copy of this list. If the list is immutable, it returns itself.

Annotations
@Override
withback to summary
public ListAdapter<T> with(T element)

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

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

Doc from org.eclipse.collections.api.collection.MutableCollection.with.

This method allows mutable and fixed size collections the ability to add elements to their existing elements. In order to support fixed size a new instance of a collection would have to be returned taking the elements of the original collection and appending the new element to form the new collection. In the case of mutable collections, the original collection is modified, and is returned. In order to use this method properly with mutable and fixed size collections the following approach must be taken:

MutableCollection<String> list = list.with("1");
list = list.with("2");
return list;
In the case of FixedSizeCollection a new instance of MutableCollection will be returned by with, and any variables that previously referenced the original collection will need to be redirected to reference the new instance. For other MutableCollection types you will replace the reference to collection with the same collection, since the instance will return "this" after calling add on itself.
Annotations
@Override
withback to summary
public ListAdapter<T> with(T element1, T element2)
withback to summary
public ListAdapter<T> with(T element1, T element2, T element3)
withback to summary
public ListAdapter<T> with(T... elements)

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

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

Doc from org.eclipse.collections.api.collection.MutableCollection.with.

This method allows mutable and fixed size collections the ability to add elements to their existing elements. In order to support fixed size a new instance of a collection would have to be returned taking the elements of the original collection and appending the new element to form the new collection. In the case of mutable collections, the original collection is modified, and is returned. In order to use this method properly with mutable and fixed size collections the following approach must be taken:

MutableCollection<String> list = list.with("1");
list = list.with("2");
return list;
In the case of FixedSizeCollection a new instance of MutableCollection will be returned by with, and any variables that previously referenced the original collection will need to be redirected to reference the new instance. For other MutableCollection types you will replace the reference to collection with the same collection, since the instance will return "this" after calling add on itself.
withAllback to summary
public ListAdapter<T> withAll(Iterable<? extends T> elements)

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

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

Doc from org.eclipse.collections.api.collection.MutableCollection.withAll.

This method allows mutable and fixed size collections the ability to add multiple elements to their existing elements. In order to support fixed size a new instance of a collection would have to be returned taking the elements of the original collection and appending the new elements to form the new collection. In the case of mutable collections, the original collection is modified, and is returned. In order to use this method properly with mutable and fixed size collections the following approach must be taken:

MutableCollection<String> list = list.withAll(FastList.newListWith("1", "2"));
In the case of FixedSizeCollection a new instance of MutableCollection will be returned by withAll, and any variables that previously referenced the original collection will need to be redirected to reference the new instance. For other MutableCollection types you will replace the reference to collection with the same collection, since the instance will return "this" after calling addAll on itself.
Annotations
@Override
withoutback to summary
public ListAdapter<T> without(T element)

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

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

Doc from org.eclipse.collections.api.collection.MutableCollection.without.

This method allows mutable and fixed size collections the ability to remove elements from their existing elements. In order to support fixed size a new instance of a collection would have to be returned containing the elements that would be left from the original collection after calling remove. In the case of mutable collections, the original collection is modified, and is returned. In order to use this method properly with mutable and fixed size collections the following approach must be taken:

MutableCollection<String> list = list.without("1");
list = list.without("2");
return list;
In the case of FixedSizeCollection a new instance of MutableCollection will be returned by without, and any variables that previously referenced the original collection will need to be redirected to reference the new instance. For other MutableCollection types you will replace the reference to collection with the same collection, since the instance will return "this" after calling remove on itself.
Annotations
@Override
withoutAllback to summary
public ListAdapter<T> withoutAll(Iterable<? extends T> elements)

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

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

Doc from org.eclipse.collections.api.collection.MutableCollection.withoutAll.

This method allows mutable and fixed size collections the ability to remove multiple elements from their existing elements. In order to support fixed size a new instance of a collection would have to be returned containing the elements that would be left from the original collection after calling removeAll. In the case of mutable collections, the original collection is modified, and is returned. In order to use this method properly with mutable and fixed size collections the following approach must be taken:

MutableCollection<String> list = list.withoutAll(FastList.newListWith("1", "2"));
In the case of FixedSizeCollection a new instance of MutableCollection will be returned by withoutAll, and any variables that previously referenced the original collection will need to be redirected to reference the new instance. For other MutableCollection types you will replace the reference to collection with the same collection, since the instance will return "this" after calling removeAll on itself.
Annotations
@Override