Top Description Inners Constructors Methods
org.eclipse.collections.impl.set.immutable

public abstract Class AbstractImmutableSet<T>

extends AbstractImmutableCollection<T>
implements ImmutableSet<T>, Set<T>
Class Inheritance
All Implemented Interfaces
java.util.Set, java.util.Collection, java.lang.Iterable, org.eclipse.collections.api.set.ImmutableSet, org.eclipse.collections.api.set.ImmutableSetIterable, org.eclipse.collections.api.collection.ImmutableCollection, 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.immutable.ImmutableDoubletonSet, org.eclipse.collections.impl.set.immutable.ImmutableEmptySet, org.eclipse.collections.impl.set.immutable.ImmutableQuadrupletonSet, org.eclipse.collections.impl.set.immutable.ImmutableSingletonSet, org.eclipse.collections.impl.set.immutable.ImmutableTripletonSet, org.eclipse.collections.impl.set.immutable.ImmutableUnifiedSet, org.eclipse.collections.impl.set.strategy.immutable.ImmutableEmptySetWithHashingStrategy, org.eclipse.collections.impl.set.strategy.immutable.ImmutableUnifiedSetWithHashingStrategy
Imports
java.util.Collection, .Iterator, .Objects, .Set, java.util.concurrent.ExecutorService, 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.collection.MutableCollection, org.eclipse.collections.api.factory.Sets, org.eclipse.collections.api.factory.primitive.BooleanSets, .ByteSets, .CharSets, .DoubleSets, .FloatSets, .IntSets, .LongSets, .ShortSets, org.eclipse.collections.api.list.MutableList, org.eclipse.collections.api.multimap.MutableMultimap, org.eclipse.collections.api.multimap.set.ImmutableSetMultimap, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.partition.set.PartitionImmutableSet, .PartitionMutableSet, org.eclipse.collections.api.set.ImmutableSet, .MutableSet, .ParallelUnsortedSetIterable, .SetIterable, .UnsortedSetIterable, org.eclipse.collections.api.set.primitive.ImmutableBooleanSet, .ImmutableByteSet, .ImmutableCharSet, .ImmutableDoubleSet, .ImmutableFloatSet, .ImmutableIntSet, .ImmutableLongSet, .ImmutableShortSet, .MutableBooleanSet, .MutableByteSet, .MutableCharSet, .MutableDoubleSet, .MutableFloatSet, .MutableIntSet, .MutableLongSet, .MutableShortSet, org.eclipse.collections.api.tuple.Pair, org.eclipse.collections.impl.block.factory.Functions, .Predicates, org.eclipse.collections.impl.block.procedure.CollectIfProcedure, .CollectProcedure, .FlatCollectProcedure, .MultimapEachPutProcedure, .MultimapPutProcedure, .PartitionPredicate2Procedure, .PartitionProcedure, .RejectProcedure, .SelectInstancesOfProcedure, .SelectProcedure, org.eclipse.collections.impl.collection.immutable.AbstractImmutableCollection, org.eclipse.collections.impl.lazy.parallel.set.NonParallelUnsortedSetIterable, org.eclipse.collections.impl.list.mutable.FastList, org.eclipse.collections.impl.multimap.set.UnifiedSetMultimap, org.eclipse.collections.impl.partition.set.PartitionUnifiedSet, org.eclipse.collections.impl.set.mutable.UnifiedSet, org.eclipse.collections.impl.utility.Iterate, org.eclipse.collections.impl.utility.internal.SetIterables

This class is the parent class for all ImmutableSets. All implementations of ImmutableSet must implement the Set interface so anArraySet.equals(anImmutableSet) can return true when the contents and order are the same.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected abstract class

Constructor Summary

AccessConstructor and Description
public

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.

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 Set<T>
public <V> ImmutableSet<V>
collect(Function<? super T, ? extends V> function)

Implements org.eclipse.collections.api.set.ImmutableSet.collect, org.eclipse.collections.api.collection.ImmutableCollection.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 ImmutableBooleanSet
collectBoolean(BooleanFunction<? super T> booleanFunction)

Implements org.eclipse.collections.api.set.ImmutableSet.collectBoolean, org.eclipse.collections.api.collection.ImmutableCollection.collectBoolean, org.eclipse.collections.api.RichIterable.collectBoolean.

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

public ImmutableByteSet
collectByte(ByteFunction<? super T> byteFunction)

Implements org.eclipse.collections.api.set.ImmutableSet.collectByte, org.eclipse.collections.api.collection.ImmutableCollection.collectByte, org.eclipse.collections.api.RichIterable.collectByte.

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

public ImmutableCharSet
collectChar(CharFunction<? super T> charFunction)

Implements org.eclipse.collections.api.set.ImmutableSet.collectChar, org.eclipse.collections.api.collection.ImmutableCollection.collectChar, org.eclipse.collections.api.RichIterable.collectChar.

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

public ImmutableDoubleSet
collectDouble(DoubleFunction<? super T> doubleFunction)

Implements org.eclipse.collections.api.set.ImmutableSet.collectDouble, org.eclipse.collections.api.collection.ImmutableCollection.collectDouble, org.eclipse.collections.api.RichIterable.collectDouble.

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

public ImmutableFloatSet
collectFloat(FloatFunction<? super T> floatFunction)

Implements org.eclipse.collections.api.set.ImmutableSet.collectFloat, org.eclipse.collections.api.collection.ImmutableCollection.collectFloat, org.eclipse.collections.api.RichIterable.collectFloat.

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

public <V> ImmutableSet<V>
collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)

Implements org.eclipse.collections.api.set.ImmutableSet.collectIf, org.eclipse.collections.api.collection.ImmutableCollection.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 ImmutableIntSet
collectInt(IntFunction<? super T> intFunction)

Implements org.eclipse.collections.api.set.ImmutableSet.collectInt, org.eclipse.collections.api.collection.ImmutableCollection.collectInt, org.eclipse.collections.api.RichIterable.collectInt.

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

public ImmutableLongSet
collectLong(LongFunction<? super T> longFunction)

Implements org.eclipse.collections.api.set.ImmutableSet.collectLong, org.eclipse.collections.api.collection.ImmutableCollection.collectLong, org.eclipse.collections.api.RichIterable.collectLong.

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

public ImmutableShortSet
collectShort(ShortFunction<? super T> shortFunction)

Implements org.eclipse.collections.api.set.ImmutableSet.collectShort, org.eclipse.collections.api.collection.ImmutableCollection.collectShort, org.eclipse.collections.api.RichIterable.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> ImmutableSet<V>
collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter)

Implements org.eclipse.collections.api.set.ImmutableSet.collectWith, org.eclipse.collections.api.collection.ImmutableCollection.collectWith, org.eclipse.collections.api.RichIterable.collectWith.

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

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

Implements org.eclipse.collections.api.set.ImmutableSet.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> ImmutableSet<V>
public <V> ImmutableSetMultimap<V, T>
groupBy(Function<? super T, ? extends V> function)

Implements org.eclipse.collections.api.set.ImmutableSet.groupBy, org.eclipse.collections.api.collection.ImmutableCollection.groupBy, org.eclipse.collections.api.RichIterable.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, R extends MutableMultimap<V, T>> R
groupBy(Function<? super T, ? extends V> function, R target)

Overrides org.eclipse.collections.impl.AbstractRichIterable.groupBy.

Implements org.eclipse.collections.api.RichIterable.groupBy.

Same as groupBy(Function), except that the results are gathered into the specified target multimap.

public <V> ImmutableSetMultimap<V, T>
groupByEach(Function<? super T, ? extends Iterable<V>> function)

Implements org.eclipse.collections.api.set.ImmutableSet.groupByEach, org.eclipse.collections.api.collection.ImmutableCollection.groupByEach, org.eclipse.collections.api.RichIterable.groupByEach.

Similar to groupBy(Function), except the result of evaluating function will return a collection of keys for each value.

public <V, R extends MutableMultimap<V, T>> R
groupByEach(Function<? super T, ? extends Iterable<V>> function, R target)

Overrides org.eclipse.collections.impl.AbstractRichIterable.groupByEach.

Implements org.eclipse.collections.api.RichIterable.groupByEach.

Same as groupByEach(Function), except that the results are gathered into the specified target multimap.

public ImmutableSet<T>
intersect(SetIterable<? extends T> set)

Implements org.eclipse.collections.api.set.ImmutableSet.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.

protected MutableCollection<T>
public ImmutableSet<T>
newWith(T element)

Implements org.eclipse.collections.api.set.ImmutableSet.newWith, org.eclipse.collections.api.collection.ImmutableCollection.newWith.

This method is similar to the with method in MutableCollection with the difference that a new copy of this collection with the element appended will be returned.

public ImmutableSet<T>
newWithAll(Iterable<? extends T> elements)

Implements org.eclipse.collections.api.set.ImmutableSet.newWithAll, org.eclipse.collections.api.collection.ImmutableCollection.newWithAll.

This method is similar to the withAll method in MutableCollection with the difference that a new copy of this collection with the elements appended will be returned.

public ImmutableSet<T>
newWithout(T element)

Implements org.eclipse.collections.api.set.ImmutableSet.newWithout, org.eclipse.collections.api.collection.ImmutableCollection.newWithout.

This method is similar to the without method in MutableCollection with the difference that a new copy of this collection with the element removed will be returned.

public ImmutableSet<T>
newWithoutAll(Iterable<? extends T> elements)

Implements org.eclipse.collections.api.set.ImmutableSet.newWithoutAll, org.eclipse.collections.api.collection.ImmutableCollection.newWithoutAll.

This method is similar to the withoutAll method in MutableCollection with the difference that a new copy of this collection with the elements removed will be returned.

protected int
public PartitionImmutableSet<T>
partition(Predicate<? super T> predicate)

Implements org.eclipse.collections.api.set.ImmutableSet.partition, org.eclipse.collections.api.collection.ImmutableCollection.partition, org.eclipse.collections.api.RichIterable.partition.

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

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

Implements org.eclipse.collections.api.set.ImmutableSet.partitionWith, org.eclipse.collections.api.collection.ImmutableCollection.partitionWith, org.eclipse.collections.api.RichIterable.partitionWith.

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

public ImmutableSet<UnsortedSetIterable<T>>
powerSet()

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

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

public ImmutableSet<T>
reject(Predicate<? super T> predicate)

Implements org.eclipse.collections.api.set.ImmutableSet.reject, org.eclipse.collections.api.collection.ImmutableCollection.reject, org.eclipse.collections.api.RichIterable.reject.

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

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

Implements org.eclipse.collections.api.set.ImmutableSet.rejectWith, org.eclipse.collections.api.collection.ImmutableCollection.rejectWith, org.eclipse.collections.api.RichIterable.rejectWith.

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

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

Implements org.eclipse.collections.api.set.ImmutableSet.select, org.eclipse.collections.api.collection.ImmutableCollection.select, org.eclipse.collections.api.RichIterable.select.

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

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

Implements org.eclipse.collections.api.set.ImmutableSet.selectWith, org.eclipse.collections.api.collection.ImmutableCollection.selectWith, org.eclipse.collections.api.RichIterable.selectWith.

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

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

Implements org.eclipse.collections.api.set.ImmutableSet.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 ImmutableSet<T>
tap(Procedure<? super T> procedure)

Implements org.eclipse.collections.api.set.ImmutableSet.tap, org.eclipse.collections.api.collection.ImmutableCollection.tap, org.eclipse.collections.api.RichIterable.tap.

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

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

Implements org.eclipse.collections.api.set.ImmutableSet.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> ImmutableSet<Pair<T, S>>
zip(Iterable<S> that)

Implements org.eclipse.collections.api.set.ImmutableSet.zip, org.eclipse.collections.api.collection.ImmutableCollection.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 ImmutableSet<Pair<T, Integer>>
Inherited from org.eclipse.collections.impl.collection.immutable.AbstractImmutableCollection:
addaddAllcastToCollectionchunkclearcountBycountByEachcountByWithgroupByUniqueKeyparallelStreamreduceremoveremoveAllremoveAllFromretainAllspliteratorstreamsumByDoublesumByFloatsumByIntsumByLongtoArraytoArray