Package org.eclipse.collections.api.list
Interface MultiReaderList<T>
- All Superinterfaces:
Cloneable,Collection<T>,InternalIterable<T>,Iterable<T>,List<T>,ListIterable<T>,MutableCollection<T>,MutableList<T>,OrderedIterable<T>,ReversibleIterable<T>,RichIterable<T>
A MultiReaderList provides thread-safe iteration for a list through methods
withReadLockAndDelegate() and withWriteLockAndDelegate().- Since:
- 10.0.
-
Method Summary
Modifier and TypeMethodDescriptionclone()newEmpty()Creates a new empty mutable version of the same collection type.Mutates this list by reversing its order and returns the current list as a result.Mutates this list by shuffling its elements.shuffleThis(Random random) Mutates this list by shuffling its elements using the specified random.default MultiReaderList<T>sortThis()Sorts the internal data structure of this list and returns the list itself as a convenience.default MultiReaderList<T>sortThis(Comparator<? super T> comparator) Sorts the internal data structure of this list and returns the list itself as a convenience.<V extends Comparable<? super V>>
MultiReaderList<T>sortThisBy(Function<? super T, ? extends V> function) Sorts the internal data structure of this list based on the natural order of the attribute returned byfunction.sortThisByBoolean(BooleanFunction<? super T> function) sortThisByByte(ByteFunction<? super T> function) sortThisByChar(CharFunction<? super T> function) sortThisByDouble(DoubleFunction<? super T> function) sortThisByFloat(FloatFunction<? super T> function) sortThisByInt(IntFunction<? super T> function) sortThisByLong(LongFunction<? super T> function) sortThisByShort(ShortFunction<? super T> function) subList(int fromIndex, int toIndex) default MultiReaderList<T>Executes the Procedure for each element in the iterable and returnsthis.default MultiReaderList<T>This method allows mutable and fixed size collections the ability to add elements to their existing elements.default MultiReaderList<T>This method allows mutable and fixed size collections the ability to add multiple elements to their existing elements.default MultiReaderList<T>This method allows mutable and fixed size collections the ability to remove elements from their existing elements.default MultiReaderList<T>withoutAll(Iterable<? extends T> elements) This method allows mutable and fixed size collections the ability to remove multiple elements from their existing elements.voidwithReadLockAndDelegate(Procedure<? super MutableList<T>> procedure) voidwithWriteLockAndDelegate(Procedure<? super MutableList<T>> procedure) Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface org.eclipse.collections.api.InternalIterable
forEach, forEachWithMethods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliteratorMethods inherited from interface org.eclipse.collections.api.list.ListIterable
asParallel, binarySearch, binarySearch, equals, forEachInBoth, get, hashCode, lastIndexOf, listIterator, listIteratorMethods inherited from interface org.eclipse.collections.api.collection.MutableCollection
addAllIterable, aggregateBy, aggregateInPlaceBy, countBy, countByEach, countByWith, groupByUniqueKey, injectIntoWith, removeAllIterable, removeIf, removeIfWith, retainAllIterable, selectAndRejectWith, sumByDouble, sumByFloat, sumByInt, sumByLongMethods inherited from interface org.eclipse.collections.api.list.MutableList
asSynchronized, asUnmodifiable, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, collectWithIndex, distinct, distinct, distinctBy, drop, dropWhile, flatCollect, flatCollectWith, getFirst, getLast, groupBy, groupByEach, indexOf, partition, partitionWhile, partitionWith, reject, rejectWith, rejectWithIndex, select, selectInstancesOf, selectWith, selectWithIndex, take, takeWhile, toArray, toArray, toImmutable, toImmutableList, toReversed, zip, zipWithIndexMethods inherited from interface org.eclipse.collections.api.ordered.OrderedIterable
collectWithIndex, corresponds, detectIndex, forEach, forEachWithIndex, forEachWithIndex, getFirstOptional, getLastOptional, max, min, rejectWithIndex, selectWithIndex, toStack, zip, zipWithIndexMethods inherited from interface org.eclipse.collections.api.ordered.ReversibleIterable
asReversed, detectLastIndex, reverseForEach, reverseForEachWithIndexMethods inherited from interface org.eclipse.collections.api.RichIterable
aggregateBy, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, count, countBy, countByEach, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, getOnly, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, into, isEmpty, makeString, makeString, makeString, makeString, max, maxBy, maxByOptional, maxOptional, maxOptional, min, minBy, minByOptional, minOptional, minOptional, noneSatisfy, noneSatisfyWith, notEmpty, reduce, reduceBy, reduceBy, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectWith, size, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toBag, toBiMap, toImmutableBag, toImmutableBiMap, toImmutableMap, toImmutableSet, toImmutableSortedBag, toImmutableSortedBag, toImmutableSortedBagBy, toImmutableSortedList, toImmutableSortedList, toImmutableSortedListBy, toImmutableSortedSet, toImmutableSortedSet, toImmutableSortedSetBy, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString
-
Method Details
-
withReadLockAndDelegate
-
withWriteLockAndDelegate
-
newEmpty
MultiReaderList<T> newEmpty()Description copied from interface:MutableCollectionCreates 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.- Specified by:
newEmptyin interfaceMutableCollection<T>- Specified by:
newEmptyin interfaceMutableList<T>
-
clone
MultiReaderList<T> clone()- Specified by:
clonein interfaceMutableList<T>
-
subList
- Specified by:
subListin interfaceList<T>- Specified by:
subListin interfaceListIterable<T>- Specified by:
subListin interfaceMutableList<T>- See Also:
-
with
Description copied from interface:MutableCollectionThis 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 ofFixedSizeCollectiona 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.- Specified by:
within interfaceMutableCollection<T>- Specified by:
within interfaceMutableList<T>- See Also:
-
without
Description copied from interface:MutableCollectionThis 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 ofFixedSizeCollectiona 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.- Specified by:
withoutin interfaceMutableCollection<T>- Specified by:
withoutin interfaceMutableList<T>- See Also:
-
withAll
Description copied from interface:MutableCollectionThis 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 ofFixedSizeCollectiona 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.- Specified by:
withAllin interfaceMutableCollection<T>- Specified by:
withAllin interfaceMutableList<T>- See Also:
-
withoutAll
Description copied from interface:MutableCollectionThis 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 ofFixedSizeCollectiona 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.- Specified by:
withoutAllin interfaceMutableCollection<T>- Specified by:
withoutAllin interfaceMutableList<T>- See Also:
-
tap
Description copied from interface:RichIterableExecutes the Procedure for each element in the iterable and returnsthis.Example using a Java 8 lambda expression:
RichIterable<Person> tapped = people.tap(person -> LOGGER.info(person.getName()));- Specified by:
tapin interfaceListIterable<T>- Specified by:
tapin interfaceMutableCollection<T>- Specified by:
tapin interfaceMutableList<T>- Specified by:
tapin interfaceOrderedIterable<T>- Specified by:
tapin interfaceReversibleIterable<T>- Specified by:
tapin interfaceRichIterable<T>- See Also:
-
sortThis
Description copied from interface:MutableListSorts the internal data structure of this list and returns the list itself as a convenience.- Specified by:
sortThisin interfaceMutableList<T>
-
sortThis
Description copied from interface:MutableListSorts the internal data structure of this list and returns the list itself as a convenience.- Specified by:
sortThisin interfaceMutableList<T>
-
sortThisBy
<V extends Comparable<? super V>> MultiReaderList<T> sortThisBy(Function<? super T, ? extends V> function) Description copied from interface:MutableListSorts the internal data structure of this list based on the natural order of the attribute returned byfunction.- Specified by:
sortThisByin interfaceMutableList<T>
-
sortThisByInt
- Specified by:
sortThisByIntin interfaceMutableList<T>
-
sortThisByBoolean
- Specified by:
sortThisByBooleanin interfaceMutableList<T>
-
sortThisByChar
- Specified by:
sortThisByCharin interfaceMutableList<T>
-
sortThisByByte
- Specified by:
sortThisByBytein interfaceMutableList<T>
-
sortThisByShort
- Specified by:
sortThisByShortin interfaceMutableList<T>
-
sortThisByFloat
- Specified by:
sortThisByFloatin interfaceMutableList<T>
-
sortThisByLong
- Specified by:
sortThisByLongin interfaceMutableList<T>
-
sortThisByDouble
- Specified by:
sortThisByDoublein interfaceMutableList<T>
-
reverseThis
MultiReaderList<T> reverseThis()Description copied from interface:MutableListMutates this list by reversing its order and returns the current list as a result.- Specified by:
reverseThisin interfaceMutableList<T>
-
shuffleThis
MultiReaderList<T> shuffleThis()Description copied from interface:MutableListMutates this list by shuffling its elements.- Specified by:
shuffleThisin interfaceMutableList<T>
-
shuffleThis
Description copied from interface:MutableListMutates this list by shuffling its elements using the specified random.- Specified by:
shuffleThisin interfaceMutableList<T>
-