@Override public MutableSet<T> with(T element) { this.add(element); return this; }
@Override public MutableSet<T> withAll(Iterable<? extends T> elements) { this.addAllIterable(elements); return this; }
private MutableSet<T> getMutableSet() { return (MutableSet<T>) this.getDelegate(); }
@Override public MutableSet<T> clone() { synchronized (this.getLock()) { return SynchronizedMutableSet.of(this.getMutableSet().clone()); } }
@Override public <R extends Set<T>> R intersectInto(SetIterable<? extends T> set, R targetSet) { synchronized (this.getLock()) { return this.getMutableSet().intersectInto(set, targetSet); } }
@Override public MutableSet<T> asSynchronized() { return SynchronizedMutableSet.of(this); }
/** * This method will take a MutableSet and wrap it directly in a SynchronizedMutableSet. It will * take any other non-Eclipse-Collections collection and first adapt it will a SetAdapter, and then return a * SynchronizedMutableSet that wraps the adapter. Additionally, a developer specifies which lock to use * with the collection. */ public static <E, S extends Set<E>> SynchronizedMutableSet<E> of(S set, Object lock) { return new SynchronizedMutableSet<>(SetAdapter.adapt(set), lock); }
@Override public MutableSet<T> without(T element) { this.remove(element); return this; }
@Override public MutableSet<T> withoutAll(Iterable<? extends T> elements) { this.removeAllIterable(elements); return this; }
@Override public MutableSet<T> asUnmodifiable() { synchronized (this.getLock()) { return UnmodifiableMutableSet.of(this); } }
protected Object writeReplace() { return new SynchronizedCollectionSerializationProxy<>(this.getMutableSet()); }
@Override public boolean isProperSubsetOf(SetIterable<? extends T> candidateSuperset) { synchronized (this.getLock()) { return this.getMutableSet().isProperSubsetOf(candidateSuperset); } }
@Override public MutableSet<T> asSynchronized() { return SynchronizedMutableSet.of(this); }
@Override public MutableSet<T> clone() { synchronized (this.getLock()) { return SynchronizedMutableSet.of(this.getMutableSet().clone()); } }
/** * This method will take a MutableSet and wrap it directly in a SynchronizedMutableSet. It will * take any other non-Eclipse-Collections collection and first adapt it will a SetAdapter, and then return a * SynchronizedMutableSet that wraps the adapter. */ public static <E, S extends Set<E>> SynchronizedMutableSet<E> of(S set) { return new SynchronizedMutableSet<>(SetAdapter.adapt(set)); }
@Override public MutableSet<T> without(T element) { this.remove(element); return this; }
@Override public MutableSet<T> withoutAll(Iterable<? extends T> elements) { this.removeAllIterable(elements); return this; }
@Override public MutableSet<T> asUnmodifiable() { synchronized (this.getLock()) { return UnmodifiableMutableSet.of(this); } }
protected Object writeReplace() { return new SynchronizedCollectionSerializationProxy<>(this.getMutableSet()); }
@Override public <R extends Set<T>> R symmetricDifferenceInto(SetIterable<? extends T> set, R targetSet) { synchronized (this.getLock()) { return this.getMutableSet().symmetricDifferenceInto(set, targetSet); } }