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

public final Class MultiReaderUnifiedSet<T>

extends AbstractMultiReaderMutableCollection<T>
implements RandomAccess, Externalizable, MultiReaderSet<T>
Class Inheritance
All Implemented Interfaces
org.eclipse.collections.api.set.MultiReaderSet, org.eclipse.collections.api.set.MutableSet, java.lang.Cloneable, org.eclipse.collections.api.set.MutableSetIterable, java.util.Set, java.util.Collection, java.lang.Iterable, org.eclipse.collections.api.collection.MutableCollection, org.eclipse.collections.api.RichIterable, org.eclipse.collections.api.InternalIterable, org.eclipse.collections.api.set.SetIterable, org.eclipse.collections.api.set.UnsortedSetIterable, java.io.Externalizable, java.io.Serializable, java.util.RandomAccess
Imports
java.io.Externalizable, .IOException, .ObjectInput, .ObjectOutput, java.util.Iterator, .RandomAccess, .Set, java.util.concurrent.ExecutorService, java.util.concurrent.locks.ReadWriteLock, .ReentrantReadWriteLock, org.eclipse.collections.api.LazyIterable, .RichIterable, 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, org.eclipse.collections.api.factory.Sets, org.eclipse.collections.api.list.MutableList, org.eclipse.collections.api.map.MutableMap, org.eclipse.collections.api.multimap.set.MutableSetMultimap, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.partition.set.PartitionMutableSet, org.eclipse.collections.api.set.ImmutableSet, .MultiReaderSet, .MutableSet, .ParallelUnsortedSetIterable, .SetIterable, .UnsortedSetIterable, org.eclipse.collections.api.set.primitive.MutableBooleanSet, .MutableByteSet, .MutableCharSet, .MutableDoubleSet, .MutableFloatSet, .MutableIntSet, .MutableLongSet, .MutableShortSet, org.eclipse.collections.api.tuple.Pair, org.eclipse.collections.impl.collection.mutable.AbstractMultiReaderMutableCollection, org.eclipse.collections.impl.lazy.parallel.set.MultiReaderParallelUnsortedSetIterable

MultiReadUnifiedSet provides a thread-safe wrapper around a UnifiedSet, using a ReentrantReadWriteLock. In order to provide true thread-safety, MultiReaderUnifiedSet does not implement iterator() as this method requires an external lock to be taken to provide thread-safe iteration. You can use an iterator() if you use the withReadLockAndDelegate() or withWriteLockAndDelegate() methods. Both of these methods take a parameter of type Procedure<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.

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 MutableSet<T>
private static final long
Inherited from org.eclipse.collections.impl.collection.mutable.AbstractMultiReaderMutableCollection:
locklockWrapper

Constructor Summary

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

private
private

Method Summary

Modifier and TypeMethod and Description
public ParallelUnsortedSetIterable<T>
asParallel(ExecutorService executorService, int batchSize)

Implements org.eclipse.collections.api.set.UnsortedSetIterable.asParallel, org.eclipse.collections.api.set.SetIterable.asParallel.

Returns a parallel iterable of this SetIterable.

pack-priv MultiReaderUnifiedSet.UntouchableMutableSet<T>
public MutableSet<T>
public MutableSet<T>
pack-priv MultiReaderUnifiedSet.UntouchableMutableSet<T>
public <B> LazyIterable<Pair<T, B>>
cartesianProduct(SetIterable<B> set)

Implements org.eclipse.collections.api.set.SetIterable.cartesianProduct.

Returns the set whose members are all possible ordered pairs (a, b) where a is a member of this and b is a member of set.

public RichIterable<RichIterable<T>>
chunk(int size)

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

Partitions elements in fixed size chunks.

public MultiReaderSet<T>
clone()

Overrides java.lang.Object.clone.

Implements org.eclipse.collections.api.set.MultiReaderSet.clone.

Creates and returns a copy of this object.

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

Implements org.eclipse.collections.api.set.MutableSet.collect, org.eclipse.collections.api.collection.MutableCollection.collect.

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

public MutableBooleanSet
collectBoolean(BooleanFunction<? super T> booleanFunction)

Overrides default org.eclipse.collections.api.set.MutableSet.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 MutableByteSet
collectByte(ByteFunction<? super T> byteFunction)

Overrides default org.eclipse.collections.api.set.MutableSet.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 MutableCharSet
collectChar(CharFunction<? super T> charFunction)

Overrides default org.eclipse.collections.api.set.MutableSet.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 MutableDoubleSet
collectDouble(DoubleFunction<? super T> doubleFunction)

Overrides default org.eclipse.collections.api.set.MutableSet.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 MutableFloatSet
collectFloat(FloatFunction<? super T> floatFunction)

Overrides default org.eclipse.collections.api.set.MutableSet.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> MutableSet<V>
collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)

Implements org.eclipse.collections.api.set.MutableSet.collectIf, org.eclipse.collections.api.collection.MutableCollection.collectIf.

Returns a new collection with the results of applying the specified function on each element of the source collection, but only for those elements which return true upon evaluation of the predicate.

public MutableIntSet
collectInt(IntFunction<? super T> intFunction)

Overrides default org.eclipse.collections.api.set.MutableSet.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 MutableLongSet
collectLong(LongFunction<? super T> longFunction)

Overrides default org.eclipse.collections.api.set.MutableSet.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 MutableShortSet
collectShort(ShortFunction<? super T> shortFunction)

Overrides default org.eclipse.collections.api.set.MutableSet.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> MutableSet<V>
collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter)

Implements org.eclipse.collections.api.set.MutableSet.collectWith, org.eclipse.collections.api.collection.MutableCollection.collectWith.

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

public MutableSet<T>
difference(SetIterable<? extends T> subtrahendSet)

Implements org.eclipse.collections.api.set.MutableSet.difference.

Returns the set of all members of this that are not members of subtrahendSet.

public <R extends Set<T>> R
differenceInto(SetIterable<? extends T> subtrahendSet, R targetSet)

Implements org.eclipse.collections.api.set.SetIterable.differenceInto.

Same as difference(SetIterable) but adds all the objects to targetSet and returns it.

public boolean
public <V> MutableSet<V>
protected MutableSet<T>
public <V> MutableSetMultimap<V, T>
groupBy(Function<? super T, ? extends V> function)

Implements org.eclipse.collections.api.set.MutableSet.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> MutableSetMultimap<V, T>
groupByEach(Function<? super T, ? extends Iterable<V>> function)

Implements org.eclipse.collections.api.set.MutableSet.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 MutableSet<T>
intersect(SetIterable<? extends T> set)

Implements org.eclipse.collections.api.set.MutableSet.intersect.

Returns the set of all objects that are members of both this and set.

public <R extends Set<T>> R
intersectInto(SetIterable<? extends T> set, R targetSet)

Implements org.eclipse.collections.api.set.SetIterable.intersectInto.

Same as intersect(SetIterable) but adds all the objects to targetSet and returns it.

public boolean
isProperSubsetOf(SetIterable<? extends T> candidateSuperset)

Implements org.eclipse.collections.api.set.SetIterable.isProperSubsetOf.

Returns true if all the members of this are also members of candidateSuperset and the two sets are not equal.

public boolean
isSubsetOf(SetIterable<? extends T> candidateSuperset)

Implements org.eclipse.collections.api.set.SetIterable.isSubsetOf.

Returns true if all the members of this are also members of candidateSuperset.

public MultiReaderSet<T>
public static <T> MultiReaderUnifiedSet<T>
public static <T> MultiReaderUnifiedSet<T>
newSet(int capacity)

public static <T> MultiReaderUnifiedSet<T>
newSet(Iterable<T> iterable)

public static <T> MultiReaderUnifiedSet<T>
newSetWith(T... elements)

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

Implements org.eclipse.collections.api.set.MutableSet.partition, org.eclipse.collections.api.collection.MutableCollection.partition.

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

public <P> PartitionMutableSet<T>
partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)

Implements org.eclipse.collections.api.set.MutableSet.partitionWith, org.eclipse.collections.api.collection.MutableCollection.partitionWith.

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

public MutableSet<UnsortedSetIterable<T>>
powerSet()

Implements org.eclipse.collections.api.set.MutableSet.powerSet.

Returns the set whose members are all possible subsets of this.

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 MutableSet<T>
reject(Predicate<? super T> predicate)

Implements org.eclipse.collections.api.set.MutableSet.reject, org.eclipse.collections.api.collection.MutableCollection.reject.

Returns all elements of the source collection that return false when evaluating of the predicate.

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

Implements org.eclipse.collections.api.set.MutableSet.rejectWith, org.eclipse.collections.api.collection.MutableCollection.rejectWith.

Similar to reject(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

public MutableSet<T>
select(Predicate<? super T> predicate)

Implements org.eclipse.collections.api.set.MutableSet.select, org.eclipse.collections.api.collection.MutableCollection.select.

Returns all elements of the source collection that return true when evaluating the predicate.

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

Implements org.eclipse.collections.api.set.MutableSet.selectInstancesOf, org.eclipse.collections.api.collection.MutableCollection.selectInstancesOf.

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

public <P> MutableSet<T>
selectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Implements org.eclipse.collections.api.set.MutableSet.selectWith, org.eclipse.collections.api.collection.MutableCollection.selectWith.

Similar to select(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

public MutableSet<T>
symmetricDifference(SetIterable<? extends T> setB)

Implements org.eclipse.collections.api.set.MutableSet.symmetricDifference.

Returns the set of all objects that are a member of exactly one of this and setB (elements which are in one of the sets, but not in both).

public <R extends Set<T>> R
symmetricDifferenceInto(SetIterable<? extends T> set, R targetSet)

Implements org.eclipse.collections.api.set.SetIterable.symmetricDifferenceInto.

Same as symmetricDifference(SetIterable) but adds all the objects to targetSet and returns it.

public MultiReaderSet<T>
tap(Procedure<? super T> procedure)

Overrides default org.eclipse.collections.api.set.MultiReaderSet.tap.

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

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

public ImmutableSet<T>
public MutableSet<T>
union(SetIterable<? extends T> set)

Implements org.eclipse.collections.api.set.MutableSet.union.

Returns the set of all objects that are a member of this or set or both.

public <R extends Set<T>> R
unionInto(SetIterable<? extends T> set, R targetSet)

Implements org.eclipse.collections.api.set.SetIterable.unionInto.

Same as union(SetIterable) but adds all the objects to targetSet and returns it.

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> MutableSet<Pair<T, S>>
zip(Iterable<S> that)

Implements org.eclipse.collections.api.set.MutableSet.zip, org.eclipse.collections.api.collection.MutableCollection.zip.

Deprecated in 6.0. Use OrderedIterable#zip(Iterable) instead.

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

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