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

public final Class SetAdapter<T>

extends AbstractCollectionAdapter<T>
implements Serializable, MutableSet<T>
Class Inheritance
All Implemented Interfaces
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.Serializable
Imports
java.io.Serializable, java.util.Collection, .Set, java.util.concurrent.ExecutorService, org.eclipse.collections.api.LazyIterable, .RichIterable, org.eclipse.collections.api.block.function.Function, .Function2, 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.ordered.OrderedIterable, org.eclipse.collections.api.partition.set.PartitionMutableSet, org.eclipse.collections.api.set.ImmutableSet, .MutableSet, .ParallelUnsortedSetIterable, .SetIterable, .UnsortedSetIterable, org.eclipse.collections.api.tuple.Pair, org.eclipse.collections.impl.block.procedure.CollectionAddProcedure, .PartitionPredicate2Procedure, .PartitionProcedure, .SelectInstancesOfProcedure, org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter, org.eclipse.collections.impl.lazy.parallel.set.NonParallelUnsortedSetIterable, org.eclipse.collections.impl.multimap.set.UnifiedSetMultimap, org.eclipse.collections.impl.partition.set.PartitionUnifiedSet, org.eclipse.collections.impl.utility.ArrayIterate, .Iterate, org.eclipse.collections.impl.utility.internal.SetIterables, .SetIterate

This class provides a MutableSet wrapper around a JDK Collections Set interface instance. All the MutableSet interface methods are supported in addition to the JDK Set interface methods.

To create a new wrapper around an existing Set instance, use the adapt(Set) factory method.

Field Summary

Modifier and TypeField and Description
private final Set<T>
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv
SetAdapter(Set<T> newDelegate)

Method Summary

Modifier and TypeMethod and Description
public static <E> MutableSet<E>
adapt(Set<E> set)

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

Overrides java.lang.Object.clone.

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

Creates and returns a copy of this object.

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

Overrides org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter.collect.

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 <V> MutableSet<V>
collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter.collectIf.

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 <P, V> MutableSet<V>
collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter.collectWith.

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

Overrides org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter.groupBy.

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> UnifiedSetMultimap<V, T>
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 MutableSet<T>
newEmpty()

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

Deprecated use UnifiedSet#newSet() instead (inlineable)

Creates a new empty mutable version of the same collection type.

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

Overrides org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter.partitionWith.

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

Overrides org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter.reject.

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

Overrides org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter.select.

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>
public <P> MutableSet<T>
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>
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 SetAdapter<T>
with(T element)

Overrides default org.eclipse.collections.api.set.MutableSet.with.

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

This method allows mutable and fixed size collections the ability to add elements to their existing elements.

public SetAdapter<T>
with(T element1, T element2)

public SetAdapter<T>
with(T element1, T element2, T element3)

public SetAdapter<T>
with(T... elements)

Overrides default org.eclipse.collections.api.set.MutableSet.with.

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

This method allows mutable and fixed size collections the ability to add elements to their existing elements.

public SetAdapter<T>
withAll(Iterable<? extends T> elements)

Overrides default org.eclipse.collections.api.set.MutableSet.withAll.

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

This method allows mutable and fixed size collections the ability to add multiple elements to their existing elements.

public SetAdapter<T>
without(T element)

Overrides default org.eclipse.collections.api.set.MutableSet.without.

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

This method allows mutable and fixed size collections the ability to remove elements from their existing elements.

public SetAdapter<T>
withoutAll(Iterable<? extends T> elements)

Overrides default org.eclipse.collections.api.set.MutableSet.withoutAll.

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

This method allows mutable and fixed size collections the ability to remove multiple elements from their existing elements.

public <S> MutableSet<Pair<T, S>>
zip(Iterable<S> that)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter.zip.

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.AbstractCollectionAdapter:
addaddAlladdAllIterableallSatisfyallSatisfyWithanySatisfyanySatisfyWithappendStringasLazychunkclearcollectcollectBooleancollectBytecollectCharcollectDoublecollectFloatcollectIfcollectIntcollectLongcollectShortcollectWithcontainsAllArgumentscontainsAllIterablecountcountWithdetectdetectIfNonedetectOptionaldetectWithdetectWithIfNonedetectWithOptionaleachflatCollectforEachWithforEachWithIndexgetFirstgetLastgetOnlygroupBygroupByEachgroupByUniqueKeygroupByUniqueKeyinjectIntoinjectIntoinjectIntoinjectIntoinjectIntoinjectIntoWithintoisEmptyiteratormaxmaxmaxByminminminBynoneSatisfynoneSatisfyWithnotEmptyrejectrejectWithremoveremoveAllremoveIfremoveIfWithretainAllretainAllIterableselectselectAndRejectWithselectWithsizesumByDoublesumByFloatsumByIntsumByLongsumOfDoublesumOfFloatsumOfIntsumOfLongtoArraytoArraytoBagtoBiMaptoListtoMaptoMaptoSettoSortedBagtoSortedBagtoSortedListtoSortedMaptoSortedMaptoSortedSettoSortedSettoStringwrapzipzipWithIndex