Top Fields Constructors Methods
org.eclipse.collections.impl.set

public abstract Class AbstractUnifiedSet<T>

extends AbstractMutableCollection<T>
implements MutableSet<T>, Pool<T>, BatchIterable<T>
Class Inheritance
All Implemented Interfaces
org.eclipse.collections.impl.parallel.BatchIterable, org.eclipse.collections.api.set.Pool, 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
Known Direct Subclasses
org.eclipse.collections.impl.set.mutable.UnifiedSet, org.eclipse.collections.impl.set.strategy.mutable.UnifiedSetWithHashingStrategy
Imports
java.util.Collection, .Optional, .Set, org.eclipse.collections.api.LazyIterable, .RichIterable, org.eclipse.collections.api.block.function.Function, .Function2, .Function3, org.eclipse.collections.api.block.predicate.Predicate, .Predicate2, org.eclipse.collections.api.factory.Sets, org.eclipse.collections.api.map.MutableMap, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.set.MutableSet, .Pool, .SetIterable, .UnsortedSetIterable, org.eclipse.collections.api.tuple.Pair, org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection, org.eclipse.collections.impl.map.mutable.UnifiedMap, org.eclipse.collections.impl.parallel.BatchIterable, org.eclipse.collections.impl.set.mutable.SynchronizedMutableSet, .UnifiedSet, .UnmodifiableMutableSet, org.eclipse.collections.impl.utility.Iterate, org.eclipse.collections.impl.utility.internal.MutableCollectionIterate, .SetIterables

Field Summary

Modifier and TypeField and Description
protected static final int
protected static final float
protected float
protected int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected int
allocate(int capacity)

protected abstract void
allocateTable(int sizeToAllocate)

public boolean
allSatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.allSatisfy.

Implements org.eclipse.collections.api.RichIterable.allSatisfy.

Returns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty.

public <P> boolean
allSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.allSatisfyWith.

Implements org.eclipse.collections.api.RichIterable.allSatisfyWith.

Returns true if the predicate evaluates to true for every element of the collection, or returns false.

public boolean
anySatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.anySatisfy.

Implements org.eclipse.collections.api.RichIterable.anySatisfy.

Returns true if the predicate evaluates to true for any element of the iterable.

public <P> boolean
anySatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.anySatisfyWith.

Implements org.eclipse.collections.api.RichIterable.anySatisfyWith.

Returns true if the predicate evaluates to true for any element of the collection, or return false.

public MutableSet<T>
public MutableSet<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>>
public abstract MutableSet<T>
clone()

Redeclares org.eclipse.collections.api.set.MutableSet.clone.

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.

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

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

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

public <V> UnifiedSet<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, org.eclipse.collections.api.RichIterable.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 <P, A> UnifiedSet<A>
collectWith(Function2<? super T, ? super P, ? extends A> function, P parameter)

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

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

protected void
computeMaxSize(int capacity)

protected abstract T
detect(Predicate<? super T> predicate, int start, int end)

public T
detect(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.detect.

Implements org.eclipse.collections.api.RichIterable.detect.

Returns the first element of the iterable for which the predicate evaluates to true or null in the case where no element returns true.

protected abstract Optional<T>
detectOptional(Predicate<? super T> predicate, int start, int end)

public Optional<T>
detectOptional(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.detectOptional.

Implements org.eclipse.collections.api.RichIterable.detectOptional.

Returns the first element of the iterable for which the predicate evaluates to true as an Optional.

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 <V> UnifiedSet<V>
public int
protected abstract Object[]
public <V> MutableMap<V, T>
groupByUniqueKey(Function<? super T, ? extends V> function)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection.groupByUniqueKey.

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.

protected int
init(int initialCapacity)

public <IV, P> IV
injectIntoWith(IV injectValue, Function3<? super IV, ? super T, ? super P, ? extends IV> function, P parameter)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection.injectIntoWith.

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

Returns the final result of evaluating function using each element of the iterable, the previous evaluation result and the parameters.

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 abstract MutableSet<T>
newEmpty(int size)

public boolean
noneSatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.noneSatisfy.

Implements org.eclipse.collections.api.RichIterable.noneSatisfy.

Returns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty.

public <P> boolean
noneSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.noneSatisfyWith.

Implements org.eclipse.collections.api.RichIterable.noneSatisfyWith.

Returns true if the predicate evaluates to false for every element of the collection, or return false.

public MutableSet<UnsortedSetIterable<T>>
powerSet()

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

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

protected abstract void
rehash(int newCapacity)

protected void
public boolean
public boolean
retainAll(Collection<?> collection)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection.retainAll.

Implements java.util.Collection.retainAll, java.util.Set.retainAll.

Retains only the elements in this set that are contained in the specified collection (optional operation).

protected abstract boolean
shortCircuit(Predicate<? super T> predicate, boolean expected, boolean onShortCircuit, boolean atEnd, int start, int end)

protected boolean
shortCircuit(Predicate<? super T> predicate, boolean expected, boolean onShortCircuit, boolean atEnd)

protected abstract <P> boolean
shortCircuitWith(Predicate2<? super T, ? super P> predicate2, P parameter, boolean expected, boolean onShortCircuit, boolean atEnd)

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

Implements org.eclipse.collections.api.set.MutableSet.zip, org.eclipse.collections.api.collection.MutableCollection.zip, org.eclipse.collections.api.RichIterable.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.AbstractMutableCollection:
addaddAlladdAllIterablecountBycountByEachcountByWithreduceremoveremoveAllremoveIfremoveIfWithretainAllIterableselectAndRejectWithsumByDoublesumByFloatsumByIntsumByLong

Field Detail

DEFAULT_INITIAL_CAPACITYback to summary
protected static final int DEFAULT_INITIAL_CAPACITY
DEFAULT_LOAD_FACTORback to summary
protected static final float DEFAULT_LOAD_FACTOR
loadFactorback to summary
protected float loadFactor
maxSizeback to summary
protected int maxSize

Constructor Detail

AbstractUnifiedSetback to summary
public AbstractUnifiedSet()

Method Detail

allocateback to summary
protected int allocate(int capacity)
allocateTableback to summary
protected abstract void allocateTable(int sizeToAllocate)
allSatisfyback to summary
public boolean allSatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.allSatisfy.

Implements org.eclipse.collections.api.RichIterable.allSatisfy.

Doc from org.eclipse.collections.api.RichIterable.allSatisfy.

Returns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty. Otherwise, returns false.

Annotations
@Override
allSatisfyWithback to summary
public <P> boolean allSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.allSatisfyWith.

Implements org.eclipse.collections.api.RichIterable.allSatisfyWith.

Doc from org.eclipse.collections.api.RichIterable.allSatisfyWith.

Returns true if the predicate evaluates to true for every element of the collection, or returns false.

Annotations
@Override
anySatisfyback to summary
public boolean anySatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.anySatisfy.

Implements org.eclipse.collections.api.RichIterable.anySatisfy.

Doc from org.eclipse.collections.api.RichIterable.anySatisfy.

Returns true if the predicate evaluates to true for any element of the iterable. Returns false if the iterable is empty, or if no element returned true when evaluating the predicate.

Annotations
@Override
anySatisfyWithback to summary
public <P> boolean anySatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.anySatisfyWith.

Implements org.eclipse.collections.api.RichIterable.anySatisfyWith.

Doc from org.eclipse.collections.api.RichIterable.anySatisfyWith.

Returns true if the predicate evaluates to true for any element of the collection, or return false. Returns false if the collection is empty.

Annotations
@Override
asSynchronizedback to summary
public MutableSet<T> asSynchronized()

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

Doc from org.eclipse.collections.api.collection.MutableCollection.asSynchronized.

Returns a synchronized wrapper backed by this collection. This is the equivalent of using Collections.synchronizedCollection(this) only with a return type that supports the full iteration protocols available on MutableCollection. The preferred way of iterating over a synchronized collection is to use the internal iteration methods which are properly synchronized internally.

 MutableCollection synchedCollection = collection.asSynchronized();
    ...
 synchedCollection.forEach(each -> ... );
 synchedCollection.select(each -> ... );
 synchedCollection.collect(each -> ... );
If you want to iterate using an imperative style, you must protect external iterators using a synchronized block. This includes explicit iterators as well as JDK 5 style for loops.

Annotations
@Override
asUnmodifiableback to summary
public MutableSet<T> asUnmodifiable()

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

Doc from org.eclipse.collections.api.set.MutableSet.asUnmodifiable.

Returns an unmodifiable view of the set.

Annotations
@Override
cartesianProductback to summary
public <B> LazyIterable<Pair<T, B>> cartesianProduct(SetIterable<B> set)

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

Doc from 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.

Annotations
@Override
chunkback to summary
public RichIterable<RichIterable<T>> chunk(int size)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection.chunk.

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

Doc from org.eclipse.collections.api.RichIterable.chunk.

Partitions elements in fixed size chunks.

Annotations
@Override
cloneback to summary
public abstract MutableSet<T> clone()

Redeclares org.eclipse.collections.api.set.MutableSet.clone.

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Annotations
@Override
@SuppressWarnings:AbstractMethodOverridesAbstractMethod
collectback to summary
public <V> UnifiedSet<V> collect(Function<? super T, ? extends V> function)

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

Doc from org.eclipse.collections.api.RichIterable.collect.

Returns a new collection with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.

Example using a Java 8 lambda expression:

RichIterable<String> names =
    people.collect(person -> person.getFirstName() + " " + person.getLastName());
Annotations
@Override
collectIfback to summary
public <V> UnifiedSet<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, org.eclipse.collections.api.RichIterable.collectIf.

Doc from org.eclipse.collections.api.RichIterable.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. This is the optimized equivalent of calling iterable.select(predicate).collect(function).

Example using a Java 8 lambda and method reference:

RichIterable<String> strings = Lists.mutable.with(1, 2, 3).collectIf(e -> e != null, Object::toString);

Example using Predicates factory:

RichIterable<String> strings = Lists.mutable.with(1, 2, 3).collectIf(Predicates.notNull(), Functions.getToString());
Annotations
@Override
collectWithback to summary
public <P, A> UnifiedSet<A> collectWith(Function2<? super T, ? super P, ? extends A> function, P parameter)

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

Doc from org.eclipse.collections.api.RichIterable.collectWith.

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

Example using a Java 8 lambda expression:

RichIterable<Integer> integers =
    Lists.mutable.with(1, 2, 3).collectWith((each, parameter) -> each + parameter, Integer.valueOf(1));
Annotations
@Override
computeMaxSizeback to summary
protected void computeMaxSize(int capacity)
detectback to summary
protected abstract T detect(Predicate<? super T> predicate, int start, int end)
detectback to summary
public T detect(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.detect.

Implements org.eclipse.collections.api.RichIterable.detect.

Doc from org.eclipse.collections.api.RichIterable.detect.

Returns the first element of the iterable for which the predicate evaluates to true or null in the case where no element returns true. This method is commonly called find.

Example using a Java 8 lambda expression:

Person person =
    people.detect(person -> person.getFirstName().equals("John") && person.getLastName().equals("Smith"));
Annotations
@Override
detectOptionalback to summary
protected abstract Optional<T> detectOptional(Predicate<? super T> predicate, int start, int end)
detectOptionalback to summary
public Optional<T> detectOptional(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.detectOptional.

Implements org.eclipse.collections.api.RichIterable.detectOptional.

Doc from org.eclipse.collections.api.RichIterable.detectOptional.

Returns the first element of the iterable for which the predicate evaluates to true as an Optional. This method is commonly called find.

Example using a Java 8 lambda expression:

Person person =
    people.detectOptional(person -> person.getFirstName().equals("John") && person.getLastName().equals("Smith"));

Annotations
@Override
differenceback to summary
public MutableSet<T> difference(SetIterable<? extends T> subtrahendSet)

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

Doc from org.eclipse.collections.api.set.SetIterable.difference.

Returns the set of all members of this that are not members of subtrahendSet. The difference of [1, 2, 3] and [2, 3, 4] is [1].

Annotations
@Override
differenceIntoback to summary
public <R extends Set<T>> R differenceInto(SetIterable<? extends T> subtrahendSet, R targetSet)

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

Doc from org.eclipse.collections.api.set.SetIterable.differenceInto.

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

Annotations
@Override
flatCollectback to summary
public <V> UnifiedSet<V> flatCollect(Function<? super T, ? extends Iterable<V>> function)

Implements org.eclipse.collections.api.set.MutableSet.flatCollect, org.eclipse.collections.api.collection.MutableCollection.flatCollect, org.eclipse.collections.api.RichIterable.flatCollect.

Doc from org.eclipse.collections.api.RichIterable.flatCollect.

flatCollect is a special case of collect(Function). With collect, when the Function returns a collection, the result is a collection of collections. flatCollect outputs a single "flattened" collection instead. This method is commonly called flatMap.

Consider the following example where we have a Person class, and each Person has a list of Address objects. Take the following Function:

Function<Person, List<Address>> addressFunction = Person::getAddresses;
RichIterable<Person> people = ...;
Using collect returns a collection of collections of addresses.
RichIterable<List<Address>> addresses = people.collect(addressFunction);
Using flatCollect returns a single flattened list of addresses.
RichIterable<Address> addresses = people.flatCollect(addressFunction);
Annotations
@Override
getBatchCountback to summary
public int getBatchCount(int batchSize)

Implements org.eclipse.collections.impl.parallel.BatchIterable.getBatchCount.

Annotations
@Override
getTableback to summary
protected abstract Object[] getTable()
groupByUniqueKeyback to summary
public <V> MutableMap<V, T> groupByUniqueKey(Function<? super T, ? extends V> function)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection.groupByUniqueKey.

Overrides default org.eclipse.collections.api.collection.MutableCollection.groupByUniqueKey.

Implements org.eclipse.collections.api.RichIterable.groupByUniqueKey.

Doc from 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. The generated keys must each be unique, or else an exception is thrown.

Annotations
@Override
initback to summary
protected int init(int initialCapacity)
injectIntoWithback to summary
public <IV, P> IV injectIntoWith(IV injectValue, Function3<? super IV, ? super T, ? super P, ? extends IV> function, P parameter)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection.injectIntoWith.

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

Doc from org.eclipse.collections.api.collection.MutableCollection.injectIntoWith.

Returns the final result of evaluating function using each element of the iterable, the previous evaluation result and the parameters. The injected value is used for the first parameter of the first evaluation, and the current item in the iterable is used as the second parameter. The parameter value is always used as the third parameter to the function call.

Annotations
@Override
intersectback to summary
public MutableSet<T> intersect(SetIterable<? extends T> set)

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

Doc from org.eclipse.collections.api.set.SetIterable.intersect.

Returns the set of all objects that are members of both this and set. The intersection of [1, 2, 3] and [2, 3, 4] is the set [2, 3]. The output will contain instances from the smaller of the two sets (this or set) based on the size. If the sizes are equal, the output will contain instances from this.

Note

If you need to ensure that the memory references from this are preserved in the resulting set, consider using this.select(that::contains) instead.

Annotations
@Override
intersectIntoback to summary
public <R extends Set<T>> R intersectInto(SetIterable<? extends T> set, R targetSet)

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

Doc from org.eclipse.collections.api.set.SetIterable.intersectInto.

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

Annotations
@Override
isProperSubsetOfback to summary
public boolean isProperSubsetOf(SetIterable<? extends T> candidateSuperset)

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

Doc from 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. For example, [1, 2] is a proper subset of [1, 2, 3], but [1, 2, 3] is not.

Annotations
@Override
isSubsetOfback to summary
public boolean isSubsetOf(SetIterable<? extends T> candidateSuperset)

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

Doc from org.eclipse.collections.api.set.SetIterable.isSubsetOf.

Returns true if all the members of this are also members of candidateSuperset. For example, [1, 2] is a subset of [1, 2, 3], but [1, 4] is not.

Annotations
@Override
newEmptyback to summary
public abstract MutableSet<T> newEmpty(int size)
noneSatisfyback to summary
public boolean noneSatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.noneSatisfy.

Implements org.eclipse.collections.api.RichIterable.noneSatisfy.

Doc from org.eclipse.collections.api.RichIterable.noneSatisfy.

Returns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty. Otherwise, returns false.

Annotations
@Override
noneSatisfyWithback to summary
public <P> boolean noneSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.noneSatisfyWith.

Implements org.eclipse.collections.api.RichIterable.noneSatisfyWith.

Doc from org.eclipse.collections.api.RichIterable.noneSatisfyWith.

Returns true if the predicate evaluates to false for every element of the collection, or return false. Returns true if the collection is empty.

Annotations
@Override
powerSetback to summary
public MutableSet<UnsortedSetIterable<T>> powerSet()

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

Doc from org.eclipse.collections.api.set.UnsortedSetIterable.powerSet.

Returns the set whose members are all possible subsets of this. For example, the powerset of [1, 2] is [[], [1], [2], [1, 2]].

Annotations
@Override
rehashback to summary
protected abstract void rehash(int newCapacity)
rehashback to summary
protected void rehash()
removeAllIterableback to summary
public boolean removeAllIterable(Iterable<?> iterable)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection.removeAllIterable.

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

Annotations
@Override
retainAllback to summary
public boolean retainAll(Collection<?> collection)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection.retainAll.

Implements java.util.Collection.retainAll, java.util.Set.retainAll.

Doc from java.util.Set.retainAll.

Retains only the elements in this set that are contained in the specified collection (optional operation). In other words, removes from this set all of its elements that are not contained in the specified collection. If the specified collection is also a set, this operation effectively modifies this set so that its value is the intersection of the two sets.

Annotations
@Override
shortCircuitback to summary
protected abstract boolean shortCircuit(Predicate<? super T> predicate, boolean expected, boolean onShortCircuit, boolean atEnd, int start, int end)
shortCircuitback to summary
protected boolean shortCircuit(Predicate<? super T> predicate, boolean expected, boolean onShortCircuit, boolean atEnd)
shortCircuitWithback to summary
protected abstract <P> boolean shortCircuitWith(Predicate2<? super T, ? super P> predicate2, P parameter, boolean expected, boolean onShortCircuit, boolean atEnd)
symmetricDifferenceback to summary
public MutableSet<T> symmetricDifference(SetIterable<? extends T> setB)

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

Doc from org.eclipse.collections.api.set.SetIterable.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). For instance, for the sets [1, 2, 3] and [2, 3, 4], the symmetric difference set is [1, 4] . It is the set difference of the union and the intersection.

Annotations
@Override
symmetricDifferenceIntoback to summary
public <R extends Set<T>> R symmetricDifferenceInto(SetIterable<? extends T> set, R targetSet)

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

Doc from org.eclipse.collections.api.set.SetIterable.symmetricDifferenceInto.

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

Annotations
@Override
unionback to summary
public MutableSet<T> union(SetIterable<? extends T> set)

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

Doc from org.eclipse.collections.api.set.SetIterable.union.

Returns the set of all objects that are a member of this or set or both. The union of [1, 2, 3] and [2, 3, 4] is the set [1, 2, 3, 4]. If equal elements appear in both sets, then the output will contain the copy from this.

Annotations
@Override
unionIntoback to summary
public <R extends Set<T>> R unionInto(SetIterable<? extends T> set, R targetSet)

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

Doc from org.eclipse.collections.api.set.SetIterable.unionInto.

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

Annotations
@Override
zipback to summary
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, org.eclipse.collections.api.RichIterable.zip.

Doc from org.eclipse.collections.api.RichIterable.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. If one of the two RichIterables is longer than the other, its remaining elements are ignored.

Annotations
@Override
@Deprecated
zipWithIndexback to summary
public MutableSet<Pair<T, Integer>> zipWithIndex()

Implements org.eclipse.collections.api.set.MutableSet.zipWithIndex, org.eclipse.collections.api.collection.MutableCollection.zipWithIndex, org.eclipse.collections.api.RichIterable.zipWithIndex.

Doc from org.eclipse.collections.api.RichIterable.zipWithIndex.

Deprecated

in 6.0. Use OrderedIterable#zipWithIndex() instead.

Zips this RichIterable with its indices.

Annotations
@Override
@Deprecated