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

public Class SynchronizedMutableList<T>

extends AbstractSynchronizedMutableCollection<T>
implements MutableList<T>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.eclipse.collections.api.list.MutableList, org.eclipse.collections.api.list.ListIterable, org.eclipse.collections.api.ordered.ReversibleIterable, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.RichIterable, org.eclipse.collections.api.InternalIterable, java.lang.Iterable, java.lang.Cloneable, java.util.List, java.util.SequencedCollection, java.util.Collection, org.eclipse.collections.api.collection.MutableCollection
Imports
java.io.Serializable, java.util.Collection, .Collections, .Comparator, .List, .ListIterator, .Optional, .Random, java.util.concurrent.ExecutorService, java.util.function.UnaryOperator, org.eclipse.collections.api.LazyIterable, org.eclipse.collections.api.block.HashingStrategy, org.eclipse.collections.api.block.function.Function, .Function2, org.eclipse.collections.api.block.function.primitive.BooleanFunction, .ByteFunction, .CharFunction, .DoubleFunction, .FloatFunction, .IntFunction, .LongFunction, .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.list.ImmutableList, .ListIterable, .MutableList, .ParallelListIterable, org.eclipse.collections.api.list.primitive.MutableBooleanList, .MutableByteList, .MutableCharList, .MutableDoubleList, .MutableFloatList, .MutableIntList, .MutableLongList, .MutableShortList, org.eclipse.collections.api.multimap.list.MutableListMultimap, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.partition.list.PartitionMutableList, org.eclipse.collections.api.stack.MutableStack, org.eclipse.collections.api.tuple.Pair, org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection, .SynchronizedCollectionSerializationProxy, org.eclipse.collections.impl.lazy.ReverseIterable, org.eclipse.collections.impl.lazy.parallel.list.SynchronizedParallelListIterable

A synchronized view of a MutableList. It is imperative that the user manually synchronize on the collection when iterating over it using the standard JDK iterator or JDK 5 for loop, as per Collections#synchronizedCollection(Collection).
See Also
MutableList#asSynchronized()

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
SynchronizedMutableList(MutableList<T> newCollection, Object newLock)

Method Summary

Modifier and TypeMethod and Description
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(int index, Collection<? extends T> collection)

Implements java.util.List.addAll.

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

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

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

Returns a parallel iterable of this ListIterable.

public LazyIterable<T>
asReversed()

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

Returns a reversed view of this ReversibleIterable.

public MutableList<T>
public MutableList<T>
public int
binarySearch(T key, Comparator<? super T> comparator)

Overrides default org.eclipse.collections.api.list.ListIterable.binarySearch.

Searches for the specified object using the binary search algorithm.

public int
binarySearch(T key)

Overrides default org.eclipse.collections.api.list.ListIterable.binarySearch.

Searches for the specified object using the binary search algorithm.

public MutableList<T>
clone()

Overrides java.lang.Object.clone.

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

Creates and returns a copy of this object.

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

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.collect.

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 MutableBooleanList
collectBoolean(BooleanFunction<? super T> booleanFunction)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.collectBoolean.

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

Implements org.eclipse.collections.api.RichIterable.collectBoolean.

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

public MutableByteList
collectByte(ByteFunction<? super T> byteFunction)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.collectByte.

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

Implements org.eclipse.collections.api.RichIterable.collectByte.

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

public MutableCharList
collectChar(CharFunction<? super T> charFunction)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.collectChar.

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

Implements org.eclipse.collections.api.RichIterable.collectChar.

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

public MutableDoubleList
collectDouble(DoubleFunction<? super T> doubleFunction)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.collectDouble.

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

Implements org.eclipse.collections.api.RichIterable.collectDouble.

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

public MutableFloatList
collectFloat(FloatFunction<? super T> floatFunction)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.collectFloat.

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

Implements org.eclipse.collections.api.RichIterable.collectFloat.

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

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

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.collectIf.

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 MutableIntList
collectInt(IntFunction<? super T> intFunction)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.collectInt.

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

Implements org.eclipse.collections.api.RichIterable.collectInt.

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

public MutableLongList
collectLong(LongFunction<? super T> longFunction)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.collectLong.

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

Implements org.eclipse.collections.api.RichIterable.collectLong.

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

public MutableShortList
collectShort(ShortFunction<? super T> shortFunction)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.collectShort.

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

Implements org.eclipse.collections.api.RichIterable.collectShort.

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

public <P, V> MutableList<V>
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.

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
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 <V> MutableList<T>
distinctBy(Function<? super T, ? extends V> function)

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

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

public MutableList<T>
drop(int count)

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

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

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

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

Returns the final elements that do not satisfy the Predicate.

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

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

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

public <T2> void
forEachInBoth(ListIterable<T2> other, Procedure2<? super T, ? super T2> procedure)

Overrides default org.eclipse.collections.api.list.ListIterable.forEachInBoth.

Iterates over this ListIterable and the other ListIterable together passing the elements of each list as parameters to the specified procedure.

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.

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.

protected MutableList<T>
public Optional<T>
getFirstOptional()

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

Returns the first element of an iterable as an Optional.

public Optional<T>
getLastOptional()

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

Returns the last element of an iterable as an Optional.

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

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.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> MutableListMultimap<V, T>
public int
indexOf(Object o)

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 int
lastIndexOf(Object o)

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 ListIterator<T>
listIterator()

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

Returns a list iterator over the elements in this list (in proper sequence).

public ListIterator<T>
listIterator(int index)

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

Returns a list iterator over the elements in this list (in proper sequence), starting at the specified position in the list.

public MutableList<T>
public static <E, L extends List<E>> SynchronizedMutableList<E>
of(L list)

Hides java.util.List.of.

This method will take a MutableList and wrap it directly in a SynchronizedMutableList.

public static <E, L extends List<E>> SynchronizedMutableList<E>
of(L list, Object lock)

Hides java.util.List.of.

This method will take a MutableList and wrap it directly in a SynchronizedMutableList.

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

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

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

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

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.rejectWith.

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 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 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 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 MutableList<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 MutableList<T>
public <S> MutableList<S>
public <P> MutableList<T>
selectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.selectWith.

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 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).

public MutableList<T>
shuffleThis()

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

Mutates this list by shuffling its elements.

public MutableList<T>
shuffleThis(Random rnd)

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

Mutates this list by shuffling its elements using the specified random.

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 MutableList<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 MutableList<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 <V extends Comparable<? super V>> MutableList<T>
sortThisBy(Function<? super T, ? extends V> function)

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

Sorts the internal data structure of this list based on the natural order of the attribute returned by function.

public MutableList<T>
public MutableList<T>
public MutableList<T>
public MutableList<T>
public MutableList<T>
public MutableList<T>
public MutableList<T>
public MutableList<T>
public MutableList<T>
subList(int fromIndex, int toIndex)

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

Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.

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

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

Returns a new MutableList in reverse order.

public MutableStack<T>
toStack()

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

Converts the OrderedIterable to a mutable MutableStack implementation.

protected Object
public <S> MutableList<Pair<T, S>>
public MutableList<Pair<T, Integer>>
Inherited from org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection:
addaddAlladdAllIterableaggregateByaggregateInPlaceByclearcountBycountByEachcountByWithgroupByUniqueKeyinjectIntoWithremoveremoveAllremoveAllIterableremoveIfremoveIfWithretainAllretainAllIterableselectAndRejectWithsumByDoublesumByFloatsumByIntsumByLong