Package org.eclipse.collections.api.set
Interface MultiReaderSet<T>
- All Superinterfaces:
Cloneable,Collection<T>,InternalIterable<T>,Iterable<T>,MutableCollection<T>,MutableSet<T>,MutableSetIterable<T>,RichIterable<T>,Set<T>,SetIterable<T>,UnsortedSetIterable<T>
A MultiReaderSet provides thread-safe iteration for a set 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.default MultiReaderSet<T>Executes the Procedure for each element in the iterable and returnsthis.default MultiReaderSet<T>This method allows mutable and fixed size collections the ability to add elements to their existing elements.default MultiReaderSet<T>This method allows mutable and fixed size collections the ability to add multiple elements to their existing elements.default MultiReaderSet<T>This method allows mutable and fixed size collections the ability to remove elements from their existing elements.default MultiReaderSet<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 MutableSet<T>> procedure) voidwithWriteLockAndDelegate(Procedure<? super MutableSet<T>> procedure) Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface org.eclipse.collections.api.InternalIterable
forEach, forEachWith, forEachWithIndexMethods 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.set.MutableSet
asSynchronized, asUnmodifiable, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, difference, flatCollect, flatCollectWith, groupBy, groupByEach, intersect, partition, partitionWith, powerSet, reject, rejectWith, select, selectInstancesOf, selectWith, symmetricDifference, toImmutable, toImmutableSet, union, zip, zipWithIndexMethods inherited from interface org.eclipse.collections.api.set.MutableSetIterable
toArray, toArrayMethods 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, getFirst, getLast, getOnly, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, into, isEmpty, makeString, makeString, makeString, makeString, max, max, maxBy, maxByOptional, maxOptional, maxOptional, min, 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, toImmutableList, toImmutableMap, 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, zip, zipWithIndexMethods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, spliteratorMethods inherited from interface org.eclipse.collections.api.set.SetIterable
cartesianProduct, differenceInto, equals, hashCode, intersectInto, isProperSubsetOf, isSubsetOf, symmetricDifferenceInto, unionIntoMethods inherited from interface org.eclipse.collections.api.set.UnsortedSetIterable
asParallel
-
Method Details
-
withReadLockAndDelegate
-
withWriteLockAndDelegate
-
newEmpty
MultiReaderSet<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 interfaceMutableSet<T>
-
clone
MultiReaderSet<T> clone()- Specified by:
clonein interfaceMutableSet<T>
-
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 interfaceMutableSet<T>- Specified by:
within interfaceMutableSetIterable<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 interfaceMutableSet<T>- Specified by:
withoutin interfaceMutableSetIterable<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 interfaceMutableSet<T>- Specified by:
withAllin interfaceMutableSetIterable<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 interfaceMutableSet<T>- Specified by:
withoutAllin interfaceMutableSetIterable<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 interfaceMutableCollection<T>- Specified by:
tapin interfaceMutableSet<T>- Specified by:
tapin interfaceMutableSetIterable<T>- Specified by:
tapin interfaceRichIterable<T>- Specified by:
tapin interfaceSetIterable<T>- Specified by:
tapin interfaceUnsortedSetIterable<T>- See Also:
-