Class MultiReaderUnifiedSet<T>
- java.lang.Object
-
- org.eclipse.collections.impl.collection.mutable.AbstractMultiReaderMutableCollection<T>
-
- org.eclipse.collections.impl.set.mutable.MultiReaderUnifiedSet<T>
-
- All Implemented Interfaces:
Externalizable
,Serializable
,Cloneable
,Iterable<T>
,Collection<T>
,RandomAccess
,Set<T>
,MutableCollection<T>
,InternalIterable<T>
,RichIterable<T>
,MultiReaderSet<T>
,MutableSet<T>
,MutableSetIterable<T>
,SetIterable<T>
,UnsortedSetIterable<T>
public final class MultiReaderUnifiedSet<T> extends AbstractMultiReaderMutableCollection<T> implements RandomAccess, Externalizable, MultiReaderSet<T>
MultiReadUnifiedSet provides a thread-safe wrapper around a UnifiedSet, using a ReentrantReadWriteLock. In order to provide true thread-safety, MultiReaderUnifiedSet does not implementiterator()
as this method requires an external lock to be taken to provide thread-safe iteration. You can use aniterator()
if you use thewithReadLockAndDelegate()
orwithWriteLockAndDelegate()
methods. Both of these methods take a parameter of typeProcedure<MutableSet>
, and a wrapped version of the underlying Unified is returned. This wrapper guarantees that no external pointer can ever reference the underlying UnifiedSet 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.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.collections.impl.collection.mutable.AbstractMultiReaderMutableCollection
AbstractMultiReaderMutableCollection.LockWrapper, AbstractMultiReaderMutableCollection.ReadWriteLockWrapper
-
-
Constructor Summary
Constructors Constructor Description MultiReaderUnifiedSet()
Deprecated.Empty default constructor used for serialization.
-
Method Summary
-
Methods inherited from class org.eclipse.collections.impl.collection.mutable.AbstractMultiReaderMutableCollection
add, addAll, addAllIterable, aggregateInPlaceBy, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, clear, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, forEachWith, forEachWithIndex, getFirst, getLast, getOnly, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoWith, into, isEmpty, iterator, makeString, makeString, makeString, makeString, max, max, maxBy, maxByOptional, maxOptional, maxOptional, min, min, minBy, minByOptional, minOptional, minOptional, noneSatisfy, noneSatisfyWith, notEmpty, parallelStream, reject, rejectWith, remove, removeAll, removeAllIterable, removeIf, removeIfWith, retainAll, retainAllIterable, select, selectAndRejectWith, selectWith, size, spliterator, stream, sumByDouble, sumByFloat, sumByInt, sumByLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toBiMap, toImmutableBag, toImmutableList, toImmutableSet, toImmutableSortedBag, toImmutableSortedBag, toImmutableSortedBagBy, toImmutableSortedList, toImmutableSortedList, toImmutableSortedListBy, toImmutableSortedSet, toImmutableSortedSet, toImmutableSortedSetBy, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndex
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface org.eclipse.collections.api.InternalIterable
forEach, forEachWith, forEachWithIndex
-
Methods inherited from interface org.eclipse.collections.api.set.MultiReaderSet
with, withAll, without, withoutAll
-
Methods inherited from interface org.eclipse.collections.api.collection.MutableCollection
addAllIterable, aggregateBy, aggregateInPlaceBy, countBy, countByEach, countByWith, flatCollectWith, injectIntoWith, removeAllIterable, removeIf, removeIfWith, retainAllIterable, selectAndRejectWith, sumByDouble, sumByFloat, sumByInt, sumByLong
-
Methods inherited from interface org.eclipse.collections.api.set.MutableSet
flatCollectWith, toImmutableSet
-
Methods inherited from interface org.eclipse.collections.api.RichIterable
aggregateBy, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, 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, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectWith, size, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, 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, zipWithIndex
-
-
-
-
Constructor Detail
-
MultiReaderUnifiedSet
@Deprecated public MultiReaderUnifiedSet()
Deprecated.Empty default constructor used for serialization.
-
-
Method Detail
-
newSet
public static <T> MultiReaderUnifiedSet<T> newSet()
-
newSet
public static <T> MultiReaderUnifiedSet<T> newSet(int capacity)
-
newSet
public static <T> MultiReaderUnifiedSet<T> newSet(Iterable<T> iterable)
-
newSetWith
public static <T> MultiReaderUnifiedSet<T> newSetWith(T... elements)
-
withReadLockAndDelegate
public void withReadLockAndDelegate(Procedure<? super MutableSet<T>> procedure)
- Specified by:
withReadLockAndDelegate
in interfaceMultiReaderSet<T>
-
withWriteLockAndDelegate
public void withWriteLockAndDelegate(Procedure<? super MutableSet<T>> procedure)
- Specified by:
withWriteLockAndDelegate
in interfaceMultiReaderSet<T>
-
asSynchronized
public MutableSet<T> asSynchronized()
- Specified by:
asSynchronized
in interfaceMutableCollection<T>
- Specified by:
asSynchronized
in interfaceMutableSet<T>
-
toImmutable
public ImmutableSet<T> toImmutable()
- Specified by:
toImmutable
in interfaceMutableCollection<T>
- Specified by:
toImmutable
in interfaceMutableSet<T>
- Specified by:
toImmutable
in interfaceSetIterable<T>
- Specified by:
toImmutable
in interfaceUnsortedSetIterable<T>
-
asUnmodifiable
public MutableSet<T> asUnmodifiable()
- Specified by:
asUnmodifiable
in interfaceMutableCollection<T>
- Specified by:
asUnmodifiable
in interfaceMutableSet<T>
-
clone
public MultiReaderSet<T> clone()
- Specified by:
clone
in interfaceMultiReaderSet<T>
- Specified by:
clone
in interfaceMutableSet<T>
-
collect
public <V> MutableSet<V> collect(Function<? super T,? extends V> function)
- Specified by:
collect
in interfaceMutableCollection<T>
- Specified by:
collect
in interfaceMutableSet<T>
- Specified by:
collect
in interfaceRichIterable<T>
- Specified by:
collect
in interfaceUnsortedSetIterable<T>
-
collectBoolean
public MutableBooleanSet collectBoolean(BooleanFunction<? super T> booleanFunction)
- Specified by:
collectBoolean
in interfaceMutableCollection<T>
- Specified by:
collectBoolean
in interfaceMutableSet<T>
- Specified by:
collectBoolean
in interfaceRichIterable<T>
- Specified by:
collectBoolean
in interfaceUnsortedSetIterable<T>
-
collectByte
public MutableByteSet collectByte(ByteFunction<? super T> byteFunction)
- Specified by:
collectByte
in interfaceMutableCollection<T>
- Specified by:
collectByte
in interfaceMutableSet<T>
- Specified by:
collectByte
in interfaceRichIterable<T>
- Specified by:
collectByte
in interfaceUnsortedSetIterable<T>
-
collectChar
public MutableCharSet collectChar(CharFunction<? super T> charFunction)
- Specified by:
collectChar
in interfaceMutableCollection<T>
- Specified by:
collectChar
in interfaceMutableSet<T>
- Specified by:
collectChar
in interfaceRichIterable<T>
- Specified by:
collectChar
in interfaceUnsortedSetIterable<T>
-
collectDouble
public MutableDoubleSet collectDouble(DoubleFunction<? super T> doubleFunction)
- Specified by:
collectDouble
in interfaceMutableCollection<T>
- Specified by:
collectDouble
in interfaceMutableSet<T>
- Specified by:
collectDouble
in interfaceRichIterable<T>
- Specified by:
collectDouble
in interfaceUnsortedSetIterable<T>
-
collectFloat
public MutableFloatSet collectFloat(FloatFunction<? super T> floatFunction)
- Specified by:
collectFloat
in interfaceMutableCollection<T>
- Specified by:
collectFloat
in interfaceMutableSet<T>
- Specified by:
collectFloat
in interfaceRichIterable<T>
- Specified by:
collectFloat
in interfaceUnsortedSetIterable<T>
-
collectInt
public MutableIntSet collectInt(IntFunction<? super T> intFunction)
- Specified by:
collectInt
in interfaceMutableCollection<T>
- Specified by:
collectInt
in interfaceMutableSet<T>
- Specified by:
collectInt
in interfaceRichIterable<T>
- Specified by:
collectInt
in interfaceUnsortedSetIterable<T>
-
collectLong
public MutableLongSet collectLong(LongFunction<? super T> longFunction)
- Specified by:
collectLong
in interfaceMutableCollection<T>
- Specified by:
collectLong
in interfaceMutableSet<T>
- Specified by:
collectLong
in interfaceRichIterable<T>
- Specified by:
collectLong
in interfaceUnsortedSetIterable<T>
-
collectShort
public MutableShortSet collectShort(ShortFunction<? super T> shortFunction)
- Specified by:
collectShort
in interfaceMutableCollection<T>
- Specified by:
collectShort
in interfaceMutableSet<T>
- Specified by:
collectShort
in interfaceRichIterable<T>
- Specified by:
collectShort
in interfaceUnsortedSetIterable<T>
-
flatCollect
public <V> MutableSet<V> flatCollect(Function<? super T,? extends Iterable<V>> function)
- Specified by:
flatCollect
in interfaceMutableCollection<T>
- Specified by:
flatCollect
in interfaceMutableSet<T>
- Specified by:
flatCollect
in interfaceRichIterable<T>
- Specified by:
flatCollect
in interfaceUnsortedSetIterable<T>
-
collectIf
public <V> MutableSet<V> collectIf(Predicate<? super T> predicate, Function<? super T,? extends V> function)
- Specified by:
collectIf
in interfaceMutableCollection<T>
- Specified by:
collectIf
in interfaceMutableSet<T>
- Specified by:
collectIf
in interfaceRichIterable<T>
- Specified by:
collectIf
in interfaceUnsortedSetIterable<T>
-
collectWith
public <P,V> MutableSet<V> collectWith(Function2<? super T,? super P,? extends V> function, P parameter)
- Specified by:
collectWith
in interfaceMutableCollection<T>
- Specified by:
collectWith
in interfaceMutableSet<T>
- Specified by:
collectWith
in interfaceRichIterable<T>
- Specified by:
collectWith
in interfaceUnsortedSetIterable<T>
-
newEmpty
public MultiReaderSet<T> newEmpty()
- Specified by:
newEmpty
in interfaceMultiReaderSet<T>
- Specified by:
newEmpty
in interfaceMutableCollection<T>
- Specified by:
newEmpty
in interfaceMutableSet<T>
-
reject
public MutableSet<T> reject(Predicate<? super T> predicate)
- Specified by:
reject
in interfaceMutableCollection<T>
- Specified by:
reject
in interfaceMutableSet<T>
- Specified by:
reject
in interfaceMutableSetIterable<T>
- Specified by:
reject
in interfaceRichIterable<T>
- Specified by:
reject
in interfaceSetIterable<T>
- Specified by:
reject
in interfaceUnsortedSetIterable<T>
-
rejectWith
public <P> MutableSet<T> rejectWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
rejectWith
in interfaceMutableCollection<T>
- Specified by:
rejectWith
in interfaceMutableSet<T>
- Specified by:
rejectWith
in interfaceMutableSetIterable<T>
- Specified by:
rejectWith
in interfaceRichIterable<T>
- Specified by:
rejectWith
in interfaceSetIterable<T>
- Specified by:
rejectWith
in interfaceUnsortedSetIterable<T>
-
tap
public MultiReaderSet<T> tap(Procedure<? super T> procedure)
- Specified by:
tap
in interfaceMultiReaderSet<T>
- Specified by:
tap
in interfaceMutableCollection<T>
- Specified by:
tap
in interfaceMutableSet<T>
- Specified by:
tap
in interfaceMutableSetIterable<T>
- Specified by:
tap
in interfaceRichIterable<T>
- Specified by:
tap
in interfaceSetIterable<T>
- Specified by:
tap
in interfaceUnsortedSetIterable<T>
-
select
public MutableSet<T> select(Predicate<? super T> predicate)
- Specified by:
select
in interfaceMutableCollection<T>
- Specified by:
select
in interfaceMutableSet<T>
- Specified by:
select
in interfaceMutableSetIterable<T>
- Specified by:
select
in interfaceRichIterable<T>
- Specified by:
select
in interfaceSetIterable<T>
- Specified by:
select
in interfaceUnsortedSetIterable<T>
-
selectWith
public <P> MutableSet<T> selectWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
selectWith
in interfaceMutableCollection<T>
- Specified by:
selectWith
in interfaceMutableSet<T>
- Specified by:
selectWith
in interfaceMutableSetIterable<T>
- Specified by:
selectWith
in interfaceRichIterable<T>
- Specified by:
selectWith
in interfaceSetIterable<T>
- Specified by:
selectWith
in interfaceUnsortedSetIterable<T>
-
partition
public PartitionMutableSet<T> partition(Predicate<? super T> predicate)
- Specified by:
partition
in interfaceMutableCollection<T>
- Specified by:
partition
in interfaceMutableSet<T>
- Specified by:
partition
in interfaceMutableSetIterable<T>
- Specified by:
partition
in interfaceRichIterable<T>
- Specified by:
partition
in interfaceSetIterable<T>
-
partitionWith
public <P> PartitionMutableSet<T> partitionWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
partitionWith
in interfaceMutableCollection<T>
- Specified by:
partitionWith
in interfaceMutableSet<T>
- Specified by:
partitionWith
in interfaceMutableSetIterable<T>
- Specified by:
partitionWith
in interfaceRichIterable<T>
- Specified by:
partitionWith
in interfaceSetIterable<T>
-
selectInstancesOf
public <S> MutableSet<S> selectInstancesOf(Class<S> clazz)
- Specified by:
selectInstancesOf
in interfaceMutableCollection<T>
- Specified by:
selectInstancesOf
in interfaceMutableSet<T>
- Specified by:
selectInstancesOf
in interfaceMutableSetIterable<T>
- Specified by:
selectInstancesOf
in interfaceRichIterable<T>
- Specified by:
selectInstancesOf
in interfaceSetIterable<T>
- Specified by:
selectInstancesOf
in interfaceUnsortedSetIterable<T>
-
equals
public boolean equals(Object o)
-
hashCode
public int hashCode()
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
groupBy
public <V> MutableSetMultimap<V,T> groupBy(Function<? super T,? extends V> function)
- Specified by:
groupBy
in interfaceMutableCollection<T>
- Specified by:
groupBy
in interfaceMutableSet<T>
- Specified by:
groupBy
in interfaceMutableSetIterable<T>
- Specified by:
groupBy
in interfaceRichIterable<T>
- Specified by:
groupBy
in interfaceUnsortedSetIterable<T>
-
groupByEach
public <V> MutableSetMultimap<V,T> groupByEach(Function<? super T,? extends Iterable<V>> function)
- Specified by:
groupByEach
in interfaceMutableCollection<T>
- Specified by:
groupByEach
in interfaceMutableSet<T>
- Specified by:
groupByEach
in interfaceMutableSetIterable<T>
- Specified by:
groupByEach
in interfaceRichIterable<T>
- Specified by:
groupByEach
in interfaceUnsortedSetIterable<T>
-
groupByUniqueKey
public <V> MutableMap<V,T> groupByUniqueKey(Function<? super T,? extends V> function)
- Specified by:
groupByUniqueKey
in interfaceMutableCollection<T>
- Specified by:
groupByUniqueKey
in interfaceRichIterable<T>
-
zip
@Deprecated public <S> MutableSet<Pair<T,S>> zip(Iterable<S> that)
Deprecated.in 6.0. UseOrderedIterable.zip(Iterable)
instead.- Specified by:
zip
in interfaceMutableCollection<T>
- Specified by:
zip
in interfaceMutableSet<T>
- Specified by:
zip
in interfaceMutableSetIterable<T>
- Specified by:
zip
in interfaceRichIterable<T>
- Specified by:
zip
in interfaceUnsortedSetIterable<T>
-
zipWithIndex
@Deprecated public MutableSet<Pair<T,Integer>> zipWithIndex()
Deprecated.in 6.0. UseOrderedIterable.zipWithIndex()
instead.- Specified by:
zipWithIndex
in interfaceMutableCollection<T>
- Specified by:
zipWithIndex
in interfaceMutableSet<T>
- Specified by:
zipWithIndex
in interfaceMutableSetIterable<T>
- Specified by:
zipWithIndex
in interfaceRichIterable<T>
- Specified by:
zipWithIndex
in interfaceSetIterable<T>
- Specified by:
zipWithIndex
in interfaceUnsortedSetIterable<T>
-
chunk
public RichIterable<RichIterable<T>> chunk(int size)
- Specified by:
chunk
in interfaceRichIterable<T>
-
union
public MutableSet<T> union(SetIterable<? extends T> set)
- Specified by:
union
in interfaceMutableSet<T>
- Specified by:
union
in interfaceSetIterable<T>
- Specified by:
union
in interfaceUnsortedSetIterable<T>
-
unionInto
public <R extends Set<T>> R unionInto(SetIterable<? extends T> set, R targetSet)
- Specified by:
unionInto
in interfaceSetIterable<T>
-
intersect
public MutableSet<T> intersect(SetIterable<? extends T> set)
- Specified by:
intersect
in interfaceMutableSet<T>
- Specified by:
intersect
in interfaceSetIterable<T>
- Specified by:
intersect
in interfaceUnsortedSetIterable<T>
-
intersectInto
public <R extends Set<T>> R intersectInto(SetIterable<? extends T> set, R targetSet)
- Specified by:
intersectInto
in interfaceSetIterable<T>
-
difference
public MutableSet<T> difference(SetIterable<? extends T> subtrahendSet)
- Specified by:
difference
in interfaceMutableSet<T>
- Specified by:
difference
in interfaceSetIterable<T>
- Specified by:
difference
in interfaceUnsortedSetIterable<T>
-
differenceInto
public <R extends Set<T>> R differenceInto(SetIterable<? extends T> subtrahendSet, R targetSet)
- Specified by:
differenceInto
in interfaceSetIterable<T>
-
symmetricDifference
public MutableSet<T> symmetricDifference(SetIterable<? extends T> setB)
- Specified by:
symmetricDifference
in interfaceMutableSet<T>
- Specified by:
symmetricDifference
in interfaceSetIterable<T>
- Specified by:
symmetricDifference
in interfaceUnsortedSetIterable<T>
-
symmetricDifferenceInto
public <R extends Set<T>> R symmetricDifferenceInto(SetIterable<? extends T> set, R targetSet)
- Specified by:
symmetricDifferenceInto
in interfaceSetIterable<T>
-
isSubsetOf
public boolean isSubsetOf(SetIterable<? extends T> candidateSuperset)
- Specified by:
isSubsetOf
in interfaceSetIterable<T>
-
isProperSubsetOf
public boolean isProperSubsetOf(SetIterable<? extends T> candidateSuperset)
- Specified by:
isProperSubsetOf
in interfaceSetIterable<T>
-
powerSet
public MutableSet<UnsortedSetIterable<T>> powerSet()
- Specified by:
powerSet
in interfaceMutableSet<T>
- Specified by:
powerSet
in interfaceUnsortedSetIterable<T>
-
cartesianProduct
public <B> LazyIterable<Pair<T,B>> cartesianProduct(SetIterable<B> set)
- Specified by:
cartesianProduct
in interfaceSetIterable<T>
-
asParallel
public ParallelUnsortedSetIterable<T> asParallel(ExecutorService executorService, int batchSize)
- Specified by:
asParallel
in interfaceSetIterable<T>
- Specified by:
asParallel
in interfaceUnsortedSetIterable<T>
-
-