package org.eclipse.collections.impl.set.mutable;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Iterator;
import java.util.RandomAccess;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.eclipse.collections.api.LazyIterable;
import org.eclipse.collections.api.RichIterable;
import org.eclipse.collections.api.block.function.Function;
import org.eclipse.collections.api.block.function.Function2;
import org.eclipse.collections.api.block.function.primitive.BooleanFunction;
import org.eclipse.collections.api.block.function.primitive.ByteFunction;
import org.eclipse.collections.api.block.function.primitive.CharFunction;
import org.eclipse.collections.api.block.function.primitive.DoubleFunction;
import org.eclipse.collections.api.block.function.primitive.FloatFunction;
import org.eclipse.collections.api.block.function.primitive.IntFunction;
import org.eclipse.collections.api.block.function.primitive.LongFunction;
import org.eclipse.collections.api.block.function.primitive.ShortFunction;
import org.eclipse.collections.api.block.predicate.Predicate;
import org.eclipse.collections.api.block.predicate.Predicate2;
import org.eclipse.collections.api.block.procedure.Procedure;
import org.eclipse.collections.api.collection.primitive.MutableBooleanCollection;
import org.eclipse.collections.api.collection.primitive.MutableByteCollection;
import org.eclipse.collections.api.collection.primitive.MutableCharCollection;
import org.eclipse.collections.api.collection.primitive.MutableDoubleCollection;
import org.eclipse.collections.api.collection.primitive.MutableFloatCollection;
import org.eclipse.collections.api.collection.primitive.MutableIntCollection;
import org.eclipse.collections.api.collection.primitive.MutableLongCollection;
import org.eclipse.collections.api.collection.primitive.MutableShortCollection;
import org.eclipse.collections.api.list.MutableList;
import org.eclipse.collections.api.map.MutableMap;
import org.eclipse.collections.api.multimap.set.MutableSetMultimap;
import org.eclipse.collections.api.ordered.OrderedIterable;
import org.eclipse.collections.api.partition.set.PartitionMutableSet;
import org.eclipse.collections.api.set.ImmutableSet;
import org.eclipse.collections.api.set.MutableSet;
import org.eclipse.collections.api.set.ParallelUnsortedSetIterable;
import org.eclipse.collections.api.set.SetIterable;
import org.eclipse.collections.api.set.UnsortedSetIterable;
import org.eclipse.collections.api.set.primitive.MutableBooleanSet;
import org.eclipse.collections.api.set.primitive.MutableByteSet;
import org.eclipse.collections.api.set.primitive.MutableCharSet;
import org.eclipse.collections.api.set.primitive.MutableDoubleSet;
import org.eclipse.collections.api.set.primitive.MutableFloatSet;
import org.eclipse.collections.api.set.primitive.MutableIntSet;
import org.eclipse.collections.api.set.primitive.MutableLongSet;
import org.eclipse.collections.api.set.primitive.MutableShortSet;
import org.eclipse.collections.api.tuple.Pair;
import org.eclipse.collections.impl.collection.mutable.AbstractMultiReaderMutableCollection;
import org.eclipse.collections.impl.factory.Sets;
import org.eclipse.collections.impl.lazy.parallel.set.MultiReaderParallelUnsortedSetIterable;
import org.eclipse.collections.impl.utility.LazyIterate;
import static org.eclipse.collections.impl.factory.Iterables.mList;
public final class MultiReaderUnifiedSet<T>
extends AbstractMultiReaderMutableCollection<T>
implements RandomAccess, Externalizable, MutableSet<T>
{
private static final long serialVersionUID = 1L;
private transient ReadWriteLock lock;
private MutableSet<T> delegate;
@SuppressWarnings("UnusedDeclaration")
@Deprecated
public MultiReaderUnifiedSet()
{
}
private MultiReaderUnifiedSet(MutableSet<T> newDelegate)
{
this(newDelegate, new ReentrantReadWriteLock());
}
private MultiReaderUnifiedSet(MutableSet<T> newDelegate, ReadWriteLock newLock)
{
this.lock = newLock;
this.delegate = newDelegate;
}
public static <T> MultiReaderUnifiedSet<T> newSet()
{
return new MultiReaderUnifiedSet<>(UnifiedSet.newSet());
}
public static <T> MultiReaderUnifiedSet<T> newSet(int capacity)
{
return new MultiReaderUnifiedSet<>(UnifiedSet.newSet(capacity));
}
public static <T> MultiReaderUnifiedSet<T> newSet(Iterable<T> iterable)
{
return new MultiReaderUnifiedSet<>(UnifiedSet.newSet(iterable));
}
public static <T> MultiReaderUnifiedSet<T> newSetWith(T... elements)
{
return new MultiReaderUnifiedSet<>(UnifiedSet.newSetWith(elements));
}
@Override
protected MutableSet<T> getDelegate()
{
return this.delegate;
}
@Override
protected ReadWriteLock getLock()
{
return this.lock;
}
UntouchableMutableSet<T> asReadUntouchable()
{
return new UntouchableMutableSet<>(this.delegate.asUnmodifiable());
}
UntouchableMutableSet<T> asWriteUntouchable()
{
return new UntouchableMutableSet<>(this.delegate);
}
public void withReadLockAndDelegate(Procedure<MutableSet<T>> procedure)
{
this.acquireReadLock();
try
{
UntouchableMutableSet<T> untouchableSet = this.asReadUntouchable();
procedure.value(untouchableSet);
untouchableSet.becomeUseless();
}
finally
{
this.unlockReadLock();
}
}
public void withWriteLockAndDelegate(Procedure<MutableSet<T>> procedure)
{
this.acquireWriteLock();
try
{
UntouchableMutableSet<T> untouchableSet = this.asWriteUntouchable();
procedure.value(untouchableSet);
untouchableSet.becomeUseless();
}
finally
{
this.unlockWriteLock();
}
}
@Override
public MutableSet<T> asSynchronized()
{
this.acquireReadLock();
try
{
return SynchronizedMutableSet.of(this);
}
finally
{
this.unlockReadLock();
}
}
@Override
public ImmutableSet<T> toImmutable()
{
this.acquireReadLock();
try
{
return Sets.immutable.withAll(this.delegate);
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableSet<T> asUnmodifiable()
{
this.acquireReadLock();
try
{
return UnmodifiableMutableSet.of(this);
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableSet<T> clone()
{
this.acquireReadLock();
try
{
return new MultiReaderUnifiedSet<>(this.delegate.clone());
}
finally
{
this.unlockReadLock();
}
}
@Override
public <V> MutableSet<V> collect(Function<? super T, ? extends V> function)
{
this.acquireReadLock();
try
{
return this.delegate.collect(function);
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableBooleanSet collectBoolean(BooleanFunction<? super T> booleanFunction)
{
this.acquireReadLock();
try
{
return this.delegate.collectBoolean(booleanFunction);
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableByteSet collectByte(ByteFunction<? super T> byteFunction)
{
this.acquireReadLock();
try
{
return this.delegate.collectByte(byteFunction);
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableCharSet collectChar(CharFunction<? super T> charFunction)
{
this.acquireReadLock();
try
{
return this.delegate.collectChar(charFunction);
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableDoubleSet collectDouble(DoubleFunction<? super T> doubleFunction)
{
this.acquireReadLock();
try
{
return this.delegate.collectDouble(doubleFunction);
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableFloatSet collectFloat(FloatFunction<? super T> floatFunction)
{
this.acquireReadLock();
try
{
return this.delegate.collectFloat(floatFunction);
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableIntSet collectInt(IntFunction<? super T> intFunction)
{
this.acquireReadLock();
try
{
return this.delegate.collectInt(intFunction);
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableLongSet collectLong(LongFunction<? super T> longFunction)
{
this.acquireReadLock();
try
{
return this.delegate.collectLong(longFunction);
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableShortSet collectShort(ShortFunction<? super T> shortFunction)
{
this.acquireReadLock();
try
{
return this.delegate.collectShort(shortFunction);
}
finally
{
this.unlockReadLock();
}
}
@Override
public <V> MutableSet<V> flatCollect(Function<? super T, ? extends Iterable<V>> function)
{
this.acquireReadLock();
try
{
return this.delegate.flatCollect(function);
}
finally
{
this.unlockReadLock();
}
}
@Override
public <V> MutableSet<V> collectIf(
Predicate<? super T> predicate,
Function<? super T, ? extends V> function)
{
this.acquireReadLock();
try
{
return this.delegate.collectIf(predicate, function);
}
finally
{
this.unlockReadLock();
}
}
@Override
public <P, V> MutableSet<V> collectWith(
Function2<? super T, ? super P, ? extends V> function,
P parameter)
{
this.acquireReadLock();
try
{
return this.delegate.collectWith(function, parameter);
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableSet<T> newEmpty()
{
return MultiReaderUnifiedSet.newSet();
}
@Override
public MutableSet<T> reject(Predicate<? super T> predicate)
{
this.acquireReadLock();
try
{
return this.delegate.reject(predicate);
}
finally
{
this.unlockReadLock();
}
}
@Override
public <P> MutableSet<T> rejectWith(
Predicate2<? super T, ? super P> predicate,
P parameter)
{
this.acquireReadLock();
try
{
return this.delegate.rejectWith(predicate, parameter);
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableSet<T> tap(Procedure<? super T> procedure)
{
this.acquireReadLock();
try
{
this.forEach(procedure);
return this;
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableSet<T> select(Predicate<? super T> predicate)
{
this.acquireReadLock();
try
{
return this.delegate.select(predicate);
}
finally
{
this.unlockReadLock();
}
}
@Override
public <P> MutableSet<T> selectWith(
Predicate2<? super T, ? super P> predicate,
P parameter)
{
this.acquireReadLock();
try
{
return this.delegate.selectWith(predicate, parameter);
}
finally
{
this.unlockReadLock();
}
}
@Override
public PartitionMutableSet<T> partition(Predicate<? super T> predicate)
{
this.acquireReadLock();
try
{
return this.delegate.partition(predicate);
}
finally
{
this.unlockReadLock();
}
}
@Override
public <P> PartitionMutableSet<T> partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)
{
this.acquireReadLock();
try
{
return this.delegate.partitionWith(predicate, parameter);
}
finally
{
this.unlockReadLock();
}
}
@Override
public <S> MutableSet<S> selectInstancesOf(Class<S> clazz)
{
this.acquireReadLock();
try
{
return this.delegate.selectInstancesOf(clazz);
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableSet<T> with(T element)
{
this.add(element);
return this;
}
@Override
public MutableSet<T> without(T element)
{
this.remove(element);
return this;
}
@Override
public MutableSet<T> withAll(Iterable<? extends T> elements)
{
this.addAllIterable(elements);
return this;
}
@Override
public MutableSet<T> withoutAll(Iterable<? extends T> elements)
{
this.removeAllIterable(elements);
return this;
}
@Override
public boolean equals(Object o)
{
this.acquireReadLock();
try
{
return this.delegate.equals(o);
}
finally
{
this.unlockReadLock();
}
}
@Override
public int hashCode()
{
this.acquireReadLock();
try
{
return this.delegate.hashCode();
}
finally
{
this.unlockReadLock();
}
}
@Override
public void writeExternal(ObjectOutput out) throws IOException
{
out.writeObject(this.delegate);
}
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
this.delegate = (MutableSet<T>) in.readObject();
this.lock = new ReentrantReadWriteLock();
}
static final class UntouchableMutableSet<T>
extends UntouchableMutableCollection<T>
implements MutableSet<T>
{
private final MutableList<UntouchableIterator<T>> requestedIterators = mList();
private UntouchableMutableSet(MutableSet<T> newDelegate)
{
this.delegate = newDelegate;
}
public void becomeUseless()
{
this.delegate = null;
this.requestedIterators.each(UntouchableIterator::becomeUseless);
}
@Override
public MutableSet<T> with(T element)
{
this.add(element);
return this;
}
@Override
public MutableSet<T> without(T element)
{
this.remove(element);
return this;
}
@Override
public MutableSet<T> withAll(Iterable<? extends T> elements)
{
this.addAllIterable(elements);
return this;
}
@Override
public MutableSet<T> withoutAll(Iterable<? extends T> elements)
{
this.removeAllIterable(elements);
return this;
}
@Override
public MutableSet<T> asSynchronized()
{
throw new UnsupportedOperationException("Cannot call asSynchronized() on " + this.getClass().getSimpleName());
}
@Override
public MutableSet<T> asUnmodifiable()
{
throw new UnsupportedOperationException("Cannot call asUnmodifiable() on " + this.getClass().getSimpleName());
}
@Override
public ImmutableSet<T> toImmutable()
{
return Sets.immutable.withAll(this.getDelegate());
}
@Override
public LazyIterable<T> asLazy()
{
return LazyIterate.adapt(this);
}
@Override
public MutableSet<T> clone()
{
return this.getDelegate().clone();
}
@Override
public <V> MutableSet<V> collect(Function<? super T, ? extends V> function)
{
return this.getDelegate().collect(function);
}
@Override
public MutableBooleanSet collectBoolean(BooleanFunction<? super T> booleanFunction)
{
return this.getDelegate().collectBoolean(booleanFunction);
}
@Override
public <R extends MutableBooleanCollection> R collectBoolean(BooleanFunction<? super T> booleanFunction, R target)
{
return this.getDelegate().collectBoolean(booleanFunction, target);
}
@Override
public MutableByteSet collectByte(ByteFunction<? super T> byteFunction)
{
return this.getDelegate().collectByte(byteFunction);
}
@Override
public <R extends MutableByteCollection> R collectByte(ByteFunction<? super T> byteFunction, R target)
{
return this.getDelegate().collectByte(byteFunction, target);
}
@Override
public MutableCharSet collectChar(CharFunction<? super T> charFunction)
{
return this.getDelegate().collectChar(charFunction);
}
@Override
public <R extends MutableCharCollection> R collectChar(CharFunction<? super T> charFunction, R target)
{
return this.getDelegate().collectChar(charFunction, target);
}
@Override
public MutableDoubleSet collectDouble(DoubleFunction<? super T> doubleFunction)
{
return this.getDelegate().collectDouble(doubleFunction);
}
@Override
public <R extends MutableDoubleCollection> R collectDouble(DoubleFunction<? super T> doubleFunction, R target)
{
return this.getDelegate().collectDouble(doubleFunction, target);
}
@Override
public MutableFloatSet collectFloat(FloatFunction<? super T> floatFunction)
{
return this.getDelegate().collectFloat(floatFunction);
}
@Override
public <R extends MutableFloatCollection> R collectFloat(FloatFunction<? super T> floatFunction, R target)
{
return this.getDelegate().collectFloat(floatFunction, target);
}
@Override
public MutableIntSet collectInt(IntFunction<? super T> intFunction)
{
return this.getDelegate().collectInt(intFunction);
}
@Override
public <R extends MutableIntCollection> R collectInt(IntFunction<? super T> intFunction, R target)
{
return this.getDelegate().collectInt(intFunction, target);
}
@Override
public MutableLongSet collectLong(LongFunction<? super T> longFunction)
{
return this.getDelegate().collectLong(longFunction);
}
@Override
public <R extends MutableLongCollection> R collectLong(LongFunction<? super T> longFunction, R target)
{
return this.getDelegate().collectLong(longFunction, target);
}
@Override
public MutableShortSet collectShort(ShortFunction<? super T> shortFunction)
{
return this.getDelegate().collectShort(shortFunction);
}
@Override
public <R extends MutableShortCollection> R collectShort(ShortFunction<? super T> shortFunction, R target)
{
return this.getDelegate().collectShort(shortFunction, target);
}
@Override
public <V> MutableSet<V> flatCollect(Function<? super T, ? extends Iterable<V>> function)
{
return this.getDelegate().flatCollect(function);
}
@Override
public <V> MutableSet<V> collectIf(
Predicate<? super T> predicate,
Function<? super T, ? extends V> function)
{
return this.getDelegate().collectIf(predicate, function);
}
@Override
public <P, V> MutableSet<V> collectWith(
Function2<? super T, ? super P, ? extends V> function,
P parameter)
{
return this.getDelegate().collectWith(function, parameter);
}
@Override
public <V> MutableSetMultimap<V, T> groupBy(
Function<? super T, ? extends V> function)
{
return this.getDelegate().groupBy(function);
}
@Override
public <V> MutableSetMultimap<V, T> groupByEach(
Function<? super T, ? extends Iterable<V>> function)
{
return this.getDelegate().groupByEach(function);
}
@Override
public <V> MutableMap<V, T> groupByUniqueKey(Function<? super T, ? extends V> function)
{
return this.getDelegate().groupByUniqueKey(function);
}
@Override
public MutableSet<T> newEmpty()
{
return this.getDelegate().newEmpty();
}
@Override
public MutableSet<T> reject(Predicate<? super T> predicate)
{
return this.getDelegate().reject(predicate);
}
@Override
public <P> MutableSet<T> rejectWith(
Predicate2<? super T, ? super P> predicate,
P parameter)
{
return this.getDelegate().rejectWith(predicate, parameter);
}
@Override
public MutableSet<T> tap(Procedure<? super T> procedure)
{
this.forEach(procedure);
return this;
}
@Override
public MutableSet<T> select(Predicate<? super T> predicate)
{
return this.getDelegate().select(predicate);
}
@Override
public <P> MutableSet<T> selectWith(
Predicate2<? super T, ? super P> predicate,
P parameter)
{
return this.getDelegate().selectWith(predicate, parameter);
}
@Override
public PartitionMutableSet<T> partition(Predicate<? super T> predicate)
{
return this.getDelegate().partition(predicate);
}
@Override
public <P> PartitionMutableSet<T> partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)
{
return this.getDelegate().partitionWith(predicate, parameter);
}
@Override
public <S> MutableSet<S> selectInstancesOf(Class<S> clazz)
{
return this.getDelegate().selectInstancesOf(clazz);
}
@Override
public Iterator<T> iterator()
{
UntouchableIterator<T> iterator = new UntouchableIterator<>(this.delegate.iterator());
this.requestedIterators.add(iterator);
return iterator;
}
@Override
@Deprecated
public <S> MutableSet<Pair<T, S>> zip(Iterable<S> that)
{
return this.getDelegate().zip(that);
}
@Override
@Deprecated
public MutableSet<Pair<T, Integer>> zipWithIndex()
{
return this.getDelegate().zipWithIndex();
}
@Override
public MutableSet<T> union(SetIterable<? extends T> set)
{
return this.getDelegate().union(set);
}
@Override
public <R extends Set<T>> R unionInto(SetIterable<? extends T> set, R targetSet)
{
return this.getDelegate().unionInto(set, targetSet);
}
@Override
public MutableSet<T> intersect(SetIterable<? extends T> set)
{
return this.getDelegate().intersect(set);
}
@Override
public <R extends Set<T>> R intersectInto(SetIterable<? extends T> set, R targetSet)
{
return this.getDelegate().intersectInto(set, targetSet);
}
@Override
public MutableSet<T> difference(SetIterable<? extends T> subtrahendSet)
{
return this.getDelegate().difference(subtrahendSet);
}
@Override
public <R extends Set<T>> R differenceInto(SetIterable<? extends T> subtrahendSet, R targetSet)
{
return this.getDelegate().differenceInto(subtrahendSet, targetSet);
}
@Override
public MutableSet<T> symmetricDifference(SetIterable<? extends T> setB)
{
return this.getDelegate().symmetricDifference(setB);
}
@Override
public <R extends Set<T>> R symmetricDifferenceInto(SetIterable<? extends T> set, R targetSet)
{
return this.getDelegate().symmetricDifferenceInto(set, targetSet);
}
@Override
public boolean isSubsetOf(SetIterable<? extends T> candidateSuperset)
{
return this.getDelegate().isSubsetOf(candidateSuperset);
}
@Override
public boolean isProperSubsetOf(SetIterable<? extends T> candidateSuperset)
{
return this.getDelegate().isProperSubsetOf(candidateSuperset);
}
@Override
public MutableSet<UnsortedSetIterable<T>> powerSet()
{
return this.getDelegate().powerSet();
}
@Override
public <B> LazyIterable<Pair<T, B>> cartesianProduct(SetIterable<B> set)
{
return this.getDelegate().cartesianProduct(set);
}
@Override
public ParallelUnsortedSetIterable<T> asParallel(ExecutorService executorService, int batchSize)
{
return this.getDelegate().asParallel(executorService, batchSize);
}
private MutableSet<T> getDelegate()
{
return (MutableSet<T>) this.delegate;
}
}
private static final class UntouchableIterator<T>
implements Iterator<T>
{
private Iterator<T> delegate;
private UntouchableIterator(Iterator<T> newDelegate)
{
this.delegate = newDelegate;
}
@Override
public boolean hasNext()
{
return this.delegate.hasNext();
}
@Override
public T next()
{
return this.delegate.next();
}
@Override
public void remove()
{
this.delegate.remove();
}
public void becomeUseless()
{
this.delegate = null;
}
}
@Override
public <V> MutableSetMultimap<V, T> groupBy(Function<? super T, ? extends V> function)
{
this.acquireReadLock();
try
{
return this.delegate.groupBy(function);
}
finally
{
this.unlockReadLock();
}
}
@Override
public <V> MutableSetMultimap<V, T> groupByEach(Function<? super T, ? extends Iterable<V>> function)
{
this.acquireReadLock();
try
{
return this.delegate.groupByEach(function);
}
finally
{
this.unlockReadLock();
}
}
@Override
public <V> MutableMap<V, T> groupByUniqueKey(Function<? super T, ? extends V> function)
{
this.acquireReadLock();
try
{
return this.delegate.groupByUniqueKey(function);
}
finally
{
this.unlockReadLock();
}
}
@Override
@Deprecated
public <S> MutableSet<Pair<T, S>> zip(Iterable<S> that)
{
this.acquireReadLock();
try
{
return this.delegate.zip(that);
}
finally
{
this.unlockReadLock();
}
}
@Override
@Deprecated
public MutableSet<Pair<T, Integer>> zipWithIndex()
{
this.acquireReadLock();
try
{
return this.delegate.zipWithIndex();
}
finally
{
this.unlockReadLock();
}
}
@Override
public RichIterable<RichIterable<T>> chunk(int size)
{
this.acquireReadLock();
try
{
return this.delegate.chunk(size);
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableSet<T> union(SetIterable<? extends T> set)
{
this.acquireReadLock();
try
{
return this.delegate.union(set);
}
finally
{
this.unlockReadLock();
}
}
@Override
public <R extends Set<T>> R unionInto(SetIterable<? extends T> set, R targetSet)
{
this.acquireReadLock();
try
{
return this.delegate.unionInto(set, targetSet);
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableSet<T> intersect(SetIterable<? extends T> set)
{
this.acquireReadLock();
try
{
return this.delegate.intersect(set);
}
finally
{
this.unlockReadLock();
}
}
@Override
public <R extends Set<T>> R intersectInto(SetIterable<? extends T> set, R targetSet)
{
this.acquireReadLock();
try
{
return this.delegate.intersectInto(set, targetSet);
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableSet<T> difference(SetIterable<? extends T> subtrahendSet)
{
this.acquireReadLock();
try
{
return this.delegate.difference(subtrahendSet);
}
finally
{
this.unlockReadLock();
}
}
@Override
public <R extends Set<T>> R differenceInto(SetIterable<? extends T> subtrahendSet, R targetSet)
{
this.acquireReadLock();
try
{
return this.delegate.differenceInto(subtrahendSet, targetSet);
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableSet<T> symmetricDifference(SetIterable<? extends T> setB)
{
this.acquireReadLock();
try
{
return this.delegate.symmetricDifference(setB);
}
finally
{
this.unlockReadLock();
}
}
@Override
public <R extends Set<T>> R symmetricDifferenceInto(SetIterable<? extends T> set, R targetSet)
{
this.acquireReadLock();
try
{
return this.delegate.symmetricDifferenceInto(set, targetSet);
}
finally
{
this.unlockReadLock();
}
}
@Override
public boolean isSubsetOf(SetIterable<? extends T> candidateSuperset)
{
this.acquireReadLock();
try
{
return this.delegate.isSubsetOf(candidateSuperset);
}
finally
{
this.unlockReadLock();
}
}
@Override
public boolean isProperSubsetOf(SetIterable<? extends T> candidateSuperset)
{
this.acquireReadLock();
try
{
return this.delegate.isProperSubsetOf(candidateSuperset);
}
finally
{
this.unlockReadLock();
}
}
@Override
public MutableSet<UnsortedSetIterable<T>> powerSet()
{
this.acquireReadLock();
try
{
return this.delegate.powerSet();
}
finally
{
this.unlockReadLock();
}
}
@Override
public <B> LazyIterable<Pair<T, B>> cartesianProduct(SetIterable<B> set)
{
this.acquireReadLock();
try
{
return this.delegate.cartesianProduct(set);
}
finally
{
this.unlockReadLock();
}
}
@Override
public ParallelUnsortedSetIterable<T> asParallel(ExecutorService executorService, int batchSize)
{
return new MultiReaderParallelUnsortedSetIterable<>(this.delegate.asParallel(executorService, batchSize), this.lock);
}
}