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

public final Class MultiReaderFastList<T>

extends AbstractMultiReaderMutableCollection<T>
implements RandomAccess, Externalizable, MultiReaderList<T>
Class Inheritance
All Implemented Interfaces
org.eclipse.collections.api.list.MultiReaderList, 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, java.io.Externalizable, java.io.Serializable, java.util.RandomAccess
Imports
java.io.Externalizable, .IOException, .ObjectInput, .ObjectOutput, java.util.Collection, .Collections, .Comparator, .Iterator, .List, .ListIterator, .Optional, .Random, .RandomAccess, java.util.concurrent.ExecutorService, java.util.concurrent.locks.ReadWriteLock, .ReentrantReadWriteLock, java.util.function.UnaryOperator, org.eclipse.collections.api.LazyIterable, .RichIterable, 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, .ShortFunction, org.eclipse.collections.api.block.predicate.Predicate, .Predicate2, org.eclipse.collections.api.block.procedure.Procedure, .Procedure2, org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure, org.eclipse.collections.api.factory.Lists, org.eclipse.collections.api.list.ImmutableList, .ListIterable, .MultiReaderList, .MutableList, .ParallelListIterable, org.eclipse.collections.api.list.primitive.MutableBooleanList, .MutableByteList, .MutableCharList, .MutableDoubleList, .MutableFloatList, .MutableIntList, .MutableLongList, .MutableShortList, org.eclipse.collections.api.map.MutableMap, 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.AbstractMultiReaderMutableCollection, org.eclipse.collections.impl.lazy.ReverseIterable, org.eclipse.collections.impl.lazy.parallel.list.ListIterableParallelIterable, .MultiReaderParallelListIterable, org.eclipse.collections.impl.stack.mutable.ArrayStack

MultiReadFastList provides a thread-safe wrapper around a FastList, using a ReentrantReadWriteLock. In order to provide true thread-safety, MultiReaderFastList does not implement iterator(), listIterator(), listIterator(int), or get(int), as all these methods require an external lock to be taken to provide thread-safe iteration. All of these methods are available however, if you use the withReadLockAndDelegate() or withWriteLockAndDelegate() methods. Both of these methods take a parameter of type Procedure<MutableList>, and a wrapped version of the underlying FastList is returned. This wrapper guarantees that no external pointer can ever reference the underlying FastList outside a locked procedure. In the case of the read lock method, an Unmodifiable version of the collection is offered, which will throw UnsupportedOperationExceptions on any write methods like add or remove.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private MutableList<T>
private static final long
Inherited from org.eclipse.collections.impl.collection.mutable.AbstractMultiReaderMutableCollection:
locklockWrapper

Constructor Summary

AccessConstructor and Description
public
MultiReaderFastList()
Deprecated Empty default constructor used for serialization.

private
private

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.

pack-priv MultiReaderFastList.UntouchableMutableList<T>
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>
pack-priv MultiReaderFastList.UntouchableMutableList<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 RichIterable<RichIterable<T>>
chunk(int size)

Implements org.eclipse.collections.api.RichIterable.chunk.

Partitions elements in fixed size chunks.

public MultiReaderList<T>
clone()

Overrides java.lang.Object.clone.

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

Creates and returns a copy of this object.

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

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 default org.eclipse.collections.api.list.MutableList.collectBoolean, org.eclipse.collections.api.collection.MutableCollection.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 default org.eclipse.collections.api.list.MutableList.collectByte, org.eclipse.collections.api.collection.MutableCollection.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 default org.eclipse.collections.api.list.MutableList.collectChar, org.eclipse.collections.api.collection.MutableCollection.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 default org.eclipse.collections.api.list.MutableList.collectDouble, org.eclipse.collections.api.collection.MutableCollection.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 default org.eclipse.collections.api.list.MutableList.collectFloat, org.eclipse.collections.api.collection.MutableCollection.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 default org.eclipse.collections.api.list.MutableList.collectIf.

Implements org.eclipse.collections.api.collection.MutableCollection.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 default org.eclipse.collections.api.list.MutableList.collectInt, org.eclipse.collections.api.collection.MutableCollection.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 default org.eclipse.collections.api.list.MutableList.collectLong, org.eclipse.collections.api.collection.MutableCollection.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 default org.eclipse.collections.api.list.MutableList.collectShort, org.eclipse.collections.api.collection.MutableCollection.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>
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.

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

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 boolean
equals(Object o)

Overrides java.lang.Object.equals.

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

Compares the specified object with this list for equality.

public <V> MutableList<V>
public void
forEach(int startIndex, int endIndex, 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)

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

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

Similar to groupBy(Function), except the result of evaluating function will return a collection of keys for each value.

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

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

This method is not supported directly on a MultiReaderFastList.

public ListIterator<T>
listIterator(int index)

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

This method is not supported directly on a MultiReaderFastList.

public MultiReaderList<T>
public static <T> MultiReaderFastList<T>
public static <T> MultiReaderFastList<T>
newList(int capacity)

public static <T> MultiReaderFastList<T>
newList(Iterable<? extends T> iterable)

public static <T> MultiReaderFastList<T>
newListWith(T... elements)

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

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

Filters a collection into a PartitionedIterable based on the evaluation of the predicate.

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>
partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)

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

Filters a collection into a PartitionIterable based on the evaluation of the predicate.

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 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 MultiReaderList<T>
reverseThis()

Implements org.eclipse.collections.api.list.MultiReaderList.reverseThis.

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

public <S> MutableList<S>
selectInstancesOf(Class<S> clazz)

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

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

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 MultiReaderList<T>
shuffleThis()

Implements org.eclipse.collections.api.list.MultiReaderList.shuffleThis.

Mutates this list by shuffling its elements.

public MultiReaderList<T>
shuffleThis(Random rnd)

Implements org.eclipse.collections.api.list.MultiReaderList.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 MultiReaderList<T>
sortThis()

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

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

public MultiReaderList<T>
sortThis(Comparator<? super T> comparator)

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

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

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

Implements org.eclipse.collections.api.list.MultiReaderList.sortThisBy.

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

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

Implements org.eclipse.collections.api.list.MultiReaderList.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 MultiReaderList<T>
tap(Procedure<? super T> procedure)

Overrides default org.eclipse.collections.api.list.MultiReaderList.tap.

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

Executes the Procedure for each element in the iterable and returns this.

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.

public void
public void
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.

public <S> MutableList<Pair<T, S>>
zip(Iterable<S> that)

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

Returns a RichIterable formed from this RichIterable and another RichIterable by combining corresponding elements in pairs.

public MutableList<Pair<T, Integer>>
Inherited from org.eclipse.collections.impl.collection.mutable.AbstractMultiReaderMutableCollection:
addaddAlladdAllIterableaggregateInPlaceByallSatisfyallSatisfyWithanySatisfyanySatisfyWithappendStringappendStringappendStringasLazyclearcollectcollectBooleancollectBytecollectCharcollectDoublecollectFloatcollectIfcollectIntcollectLongcollectShortcollectWithcontainscontainsAllcontainsAllArgumentscontainsAllIterablecountcountWithdetectdetectIfNonedetectOptionaldetectWithdetectWithIfNonedetectWithOptionaleachflatCollectflatCollectBooleanflatCollectByteflatCollectCharflatCollectDoubleflatCollectFloatflatCollectIntflatCollectLongflatCollectShortforEachWithforEachWithIndexgetFirstgetLastgetOnlygroupBygroupByEachgroupByUniqueKeyinjectIntoinjectIntoinjectIntoinjectIntoinjectIntoinjectIntoWithintoisEmptyiteratormakeStringmakeStringmakeStringmakeStringmaxmaxmaxBymaxByOptionalmaxOptionalmaxOptionalminminminByminByOptionalminOptionalminOptionalnoneSatisfynoneSatisfyWithnotEmptyparallelStreamreduceByreduceByrejectrejectWithremoveremoveAllremoveAllIterableremoveIfremoveIfWithretainAllretainAllIterableselectselectAndRejectWithselectWithsizespliteratorstreamsumByDoublesumByFloatsumByIntsumByLongsumOfDoublesumOfFloatsumOfIntsumOfLongtoArraytoArraytoBagtoBiMaptoImmutableBagtoImmutableListtoImmutableSettoImmutableSortedBagtoImmutableSortedBagtoImmutableSortedBagBytoImmutableSortedListtoImmutableSortedListtoImmutableSortedListBytoImmutableSortedSettoImmutableSortedSettoImmutableSortedSetBytoListtoMaptoMaptoSettoSortedBagtoSortedBagtoSortedListtoSortedListtoSortedListBytoSortedMaptoSortedMaptoSortedSettoSortedSettoSortedSetBytoStringzipzipWithIndex