Class SetAdapter<T>
- java.lang.Object
-
- org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter<T>
-
- org.eclipse.collections.impl.set.mutable.SetAdapter<T>
-
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<T>,Collection<T>,Set<T>,MutableCollection<T>,InternalIterable<T>,RichIterable<T>,MutableSet<T>,MutableSetIterable<T>,SetIterable<T>,UnsortedSetIterable<T>
public final class SetAdapter<T> extends AbstractCollectionAdapter<T> implements Serializable, MutableSet<T>
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.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <E> MutableSet<E>adapt(Set<E> set)ParallelUnsortedSetIterable<T>asParallel(ExecutorService executorService, int batchSize)MutableSet<T>asSynchronized()MutableSet<T>asUnmodifiable()<B> LazyIterable<Pair<T,B>>cartesianProduct(SetIterable<B> set)MutableSet<T>clone()<V> MutableSet<V>collect(Function<? super T,? extends V> function)<V> MutableSet<V>collectIf(Predicate<? super T> predicate, Function<? super T,? extends V> function)<P,V>
MutableSet<V>collectWith(Function2<? super T,? super P,? extends V> function, P parameter)booleancontains(Object o)booleancontainsAll(Collection<?> collection)MutableSet<T>difference(SetIterable<? extends T> subtrahendSet)<R extends Set<T>>
RdifferenceInto(SetIterable<? extends T> subtrahendSet, R targetSet)booleanequals(Object obj)<V> MutableSet<V>flatCollect(Function<? super T,? extends Iterable<V>> function)<V> UnifiedSetMultimap<V,T>groupBy(Function<? super T,? extends V> function)<V> UnifiedSetMultimap<V,T>groupByEach(Function<? super T,? extends Iterable<V>> function)inthashCode()MutableSet<T>intersect(SetIterable<? extends T> set)<R extends Set<T>>
RintersectInto(SetIterable<? extends T> set, R targetSet)booleanisProperSubsetOf(SetIterable<? extends T> candidateSuperset)booleanisSubsetOf(SetIterable<? extends T> candidateSuperset)MutableSet<T>newEmpty()Deprecated.useUnifiedSet.newSet()instead (inlineable)PartitionMutableSet<T>partition(Predicate<? super T> predicate)<P> PartitionMutableSet<T>partitionWith(Predicate2<? super T,? super P> predicate, P parameter)MutableSet<UnsortedSetIterable<T>>powerSet()MutableSet<T>reject(Predicate<? super T> predicate)<P> MutableSet<T>rejectWith(Predicate2<? super T,? super P> predicate, P parameter)booleanremoveAllIterable(Iterable<?> iterable)MutableSet<T>select(Predicate<? super T> predicate)<S> MutableSet<S>selectInstancesOf(Class<S> clazz)<P> MutableSet<T>selectWith(Predicate2<? super T,? super P> predicate, P parameter)MutableSet<T>symmetricDifference(SetIterable<? extends T> setB)<R extends Set<T>>
RsymmetricDifferenceInto(SetIterable<? extends T> set, R targetSet)MutableSet<T>tap(Procedure<? super T> procedure)ImmutableSet<T>toImmutable()MutableSet<T>union(SetIterable<? extends T> set)<R extends Set<T>>
RunionInto(SetIterable<? extends T> set, R targetSet)SetAdapter<T>with(T element)SetAdapter<T>with(T... elements)SetAdapter<T>with(T element1, T element2)SetAdapter<T>with(T element1, T element2, T element3)SetAdapter<T>withAll(Iterable<? extends T> elements)SetAdapter<T>without(T element)SetAdapter<T>withoutAll(Iterable<? extends T> elements)<S> MutableSet<Pair<T,S>>zip(Iterable<S> that)Deprecated.in 6.0.MutableSet<Pair<T,Integer>>zipWithIndex()Deprecated.in 6.0.-
Methods inherited from class org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter
add, addAll, addAllIterable, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, asLazy, chunk, clear, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, containsAllArguments, containsAllIterable, count, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, forEachWith, forEachWithIndex, getFirst, getLast, getOnly, groupBy, groupByEach, groupByUniqueKey, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoWith, into, isEmpty, iterator, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, notEmpty, reject, rejectWith, remove, removeAll, removeIf, removeIfWith, retainAll, retainAllIterable, select, selectAndRejectWith, selectWith, size, sumByDouble, sumByFloat, sumByInt, sumByLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toBiMap, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedList, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toString, zip, zipWithIndex
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface org.eclipse.collections.api.InternalIterable
forEach, forEachWith, forEachWithIndex
-
Methods inherited from interface org.eclipse.collections.api.collection.MutableCollection
addAllIterable, aggregateBy, aggregateInPlaceBy, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, countBy, countByEach, countByWith, flatCollectWith, groupByUniqueKey, injectIntoWith, removeIf, removeIfWith, retainAllIterable, selectAndRejectWith, sumByDouble, sumByFloat, sumByInt, sumByLong
-
Methods inherited from interface org.eclipse.collections.api.set.MutableSet
collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, flatCollectWith, toImmutableSet
-
Methods inherited from interface org.eclipse.collections.api.RichIterable
aggregateBy, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, containsAllArguments, containsAllIterable, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, count, countBy, countByEach, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, getFirst, getLast, getOnly, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, into, isEmpty, makeString, makeString, makeString, makeString, max, max, maxBy, maxByOptional, maxOptional, maxOptional, min, min, minBy, minByOptional, minOptional, minOptional, noneSatisfy, noneSatisfyWith, notEmpty, reduce, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectWith, size, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toBiMap, toImmutableBag, toImmutableBiMap, toImmutableList, toImmutableMap, toImmutableSortedBag, toImmutableSortedBag, toImmutableSortedBagBy, toImmutableSortedList, toImmutableSortedList, toImmutableSortedListBy, toImmutableSortedSet, toImmutableSortedSet, toImmutableSortedSetBy, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndex
-
-
-
-
Method Detail
-
asUnmodifiable
public MutableSet<T> asUnmodifiable()
- Specified by:
asUnmodifiablein interfaceMutableCollection<T>- Specified by:
asUnmodifiablein interfaceMutableSet<T>
-
asSynchronized
public MutableSet<T> asSynchronized()
- Specified by:
asSynchronizedin interfaceMutableCollection<T>- Specified by:
asSynchronizedin interfaceMutableSet<T>
-
toImmutable
public ImmutableSet<T> toImmutable()
- Specified by:
toImmutablein interfaceMutableCollection<T>- Specified by:
toImmutablein interfaceMutableSet<T>- Specified by:
toImmutablein interfaceSetIterable<T>- Specified by:
toImmutablein interfaceUnsortedSetIterable<T>
-
adapt
public static <E> MutableSet<E> adapt(Set<E> set)
-
clone
public MutableSet<T> clone()
- Specified by:
clonein interfaceMutableSet<T>
-
contains
public boolean contains(Object o)
- Specified by:
containsin interfaceCollection<T>- Specified by:
containsin interfaceRichIterable<T>- Specified by:
containsin interfaceSet<T>- Overrides:
containsin classAbstractCollectionAdapter<T>
-
containsAll
public boolean containsAll(Collection<?> collection)
- Specified by:
containsAllin interfaceCollection<T>- Specified by:
containsAllin interfaceRichIterable<T>- Specified by:
containsAllin interfaceSet<T>- Overrides:
containsAllin classAbstractCollectionAdapter<T>
-
equals
public boolean equals(Object obj)
-
hashCode
public int hashCode()
-
with
public SetAdapter<T> with(T element)
- Specified by:
within interfaceMutableCollection<T>- Specified by:
within interfaceMutableSet<T>- Specified by:
within interfaceMutableSetIterable<T>
-
with
public SetAdapter<T> with(T element1, T element2)
-
with
public SetAdapter<T> with(T element1, T element2, T element3)
-
with
public SetAdapter<T> with(T... elements)
-
without
public SetAdapter<T> without(T element)
- Specified by:
withoutin interfaceMutableCollection<T>- Specified by:
withoutin interfaceMutableSet<T>- Specified by:
withoutin interfaceMutableSetIterable<T>
-
withAll
public SetAdapter<T> withAll(Iterable<? extends T> elements)
- Specified by:
withAllin interfaceMutableCollection<T>- Specified by:
withAllin interfaceMutableSet<T>- Specified by:
withAllin interfaceMutableSetIterable<T>
-
withoutAll
public SetAdapter<T> withoutAll(Iterable<? extends T> elements)
- Specified by:
withoutAllin interfaceMutableCollection<T>- Specified by:
withoutAllin interfaceMutableSet<T>- Specified by:
withoutAllin interfaceMutableSetIterable<T>
-
newEmpty
@Deprecated public MutableSet<T> newEmpty()
Deprecated.useUnifiedSet.newSet()instead (inlineable)- Specified by:
newEmptyin interfaceMutableCollection<T>- Specified by:
newEmptyin interfaceMutableSet<T>
-
tap
public MutableSet<T> tap(Procedure<? super T> procedure)
- Specified by:
tapin interfaceMutableCollection<T>- Specified by:
tapin interfaceMutableSet<T>- Specified by:
tapin interfaceMutableSetIterable<T>- Specified by:
tapin interfaceRichIterable<T>- Specified by:
tapin interfaceSetIterable<T>- Specified by:
tapin interfaceUnsortedSetIterable<T>- Overrides:
tapin classAbstractCollectionAdapter<T>
-
select
public MutableSet<T> select(Predicate<? super T> predicate)
- Specified by:
selectin interfaceMutableCollection<T>- Specified by:
selectin interfaceMutableSet<T>- Specified by:
selectin interfaceMutableSetIterable<T>- Specified by:
selectin interfaceRichIterable<T>- Specified by:
selectin interfaceSetIterable<T>- Specified by:
selectin interfaceUnsortedSetIterable<T>- Overrides:
selectin classAbstractCollectionAdapter<T>
-
reject
public MutableSet<T> reject(Predicate<? super T> predicate)
- Specified by:
rejectin interfaceMutableCollection<T>- Specified by:
rejectin interfaceMutableSet<T>- Specified by:
rejectin interfaceMutableSetIterable<T>- Specified by:
rejectin interfaceRichIterable<T>- Specified by:
rejectin interfaceSetIterable<T>- Specified by:
rejectin interfaceUnsortedSetIterable<T>- Overrides:
rejectin classAbstractCollectionAdapter<T>
-
partition
public PartitionMutableSet<T> partition(Predicate<? super T> predicate)
- Specified by:
partitionin interfaceMutableCollection<T>- Specified by:
partitionin interfaceMutableSet<T>- Specified by:
partitionin interfaceMutableSetIterable<T>- Specified by:
partitionin interfaceRichIterable<T>- Specified by:
partitionin interfaceSetIterable<T>- Overrides:
partitionin classAbstractCollectionAdapter<T>
-
partitionWith
public <P> PartitionMutableSet<T> partitionWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
partitionWithin interfaceMutableCollection<T>- Specified by:
partitionWithin interfaceMutableSet<T>- Specified by:
partitionWithin interfaceMutableSetIterable<T>- Specified by:
partitionWithin interfaceRichIterable<T>- Specified by:
partitionWithin interfaceSetIterable<T>- Overrides:
partitionWithin classAbstractCollectionAdapter<T>
-
selectInstancesOf
public <S> MutableSet<S> selectInstancesOf(Class<S> clazz)
- Specified by:
selectInstancesOfin interfaceMutableCollection<T>- Specified by:
selectInstancesOfin interfaceMutableSet<T>- Specified by:
selectInstancesOfin interfaceMutableSetIterable<T>- Specified by:
selectInstancesOfin interfaceRichIterable<T>- Specified by:
selectInstancesOfin interfaceSetIterable<T>- Specified by:
selectInstancesOfin interfaceUnsortedSetIterable<T>- Overrides:
selectInstancesOfin classAbstractCollectionAdapter<T>
-
collect
public <V> MutableSet<V> collect(Function<? super T,? extends V> function)
- Specified by:
collectin interfaceMutableCollection<T>- Specified by:
collectin interfaceMutableSet<T>- Specified by:
collectin interfaceRichIterable<T>- Specified by:
collectin interfaceUnsortedSetIterable<T>- Overrides:
collectin classAbstractCollectionAdapter<T>
-
flatCollect
public <V> MutableSet<V> flatCollect(Function<? super T,? extends Iterable<V>> function)
- Specified by:
flatCollectin interfaceMutableCollection<T>- Specified by:
flatCollectin interfaceMutableSet<T>- Specified by:
flatCollectin interfaceRichIterable<T>- Specified by:
flatCollectin interfaceUnsortedSetIterable<T>- Overrides:
flatCollectin classAbstractCollectionAdapter<T>
-
collectIf
public <V> MutableSet<V> collectIf(Predicate<? super T> predicate, Function<? super T,? extends V> function)
- Specified by:
collectIfin interfaceMutableCollection<T>- Specified by:
collectIfin interfaceMutableSet<T>- Specified by:
collectIfin interfaceRichIterable<T>- Specified by:
collectIfin interfaceUnsortedSetIterable<T>- Overrides:
collectIfin classAbstractCollectionAdapter<T>
-
groupBy
public <V> UnifiedSetMultimap<V,T> groupBy(Function<? super T,? extends V> function)
- Specified by:
groupByin interfaceMutableCollection<T>- Specified by:
groupByin interfaceMutableSet<T>- Specified by:
groupByin interfaceMutableSetIterable<T>- Specified by:
groupByin interfaceRichIterable<T>- Specified by:
groupByin interfaceUnsortedSetIterable<T>- Overrides:
groupByin classAbstractCollectionAdapter<T>
-
groupByEach
public <V> UnifiedSetMultimap<V,T> groupByEach(Function<? super T,? extends Iterable<V>> function)
- Specified by:
groupByEachin interfaceMutableCollection<T>- Specified by:
groupByEachin interfaceMutableSet<T>- Specified by:
groupByEachin interfaceMutableSetIterable<T>- Specified by:
groupByEachin interfaceRichIterable<T>- Specified by:
groupByEachin interfaceUnsortedSetIterable<T>- Overrides:
groupByEachin classAbstractCollectionAdapter<T>
-
selectWith
public <P> MutableSet<T> selectWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
selectWithin interfaceMutableCollection<T>- Specified by:
selectWithin interfaceMutableSet<T>- Specified by:
selectWithin interfaceMutableSetIterable<T>- Specified by:
selectWithin interfaceRichIterable<T>- Specified by:
selectWithin interfaceSetIterable<T>- Specified by:
selectWithin interfaceUnsortedSetIterable<T>- Overrides:
selectWithin classAbstractCollectionAdapter<T>
-
rejectWith
public <P> MutableSet<T> rejectWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
rejectWithin interfaceMutableCollection<T>- Specified by:
rejectWithin interfaceMutableSet<T>- Specified by:
rejectWithin interfaceMutableSetIterable<T>- Specified by:
rejectWithin interfaceRichIterable<T>- Specified by:
rejectWithin interfaceSetIterable<T>- Specified by:
rejectWithin interfaceUnsortedSetIterable<T>- Overrides:
rejectWithin classAbstractCollectionAdapter<T>
-
collectWith
public <P,V> MutableSet<V> collectWith(Function2<? super T,? super P,? extends V> function, P parameter)
- Specified by:
collectWithin interfaceMutableCollection<T>- Specified by:
collectWithin interfaceMutableSet<T>- Specified by:
collectWithin interfaceRichIterable<T>- Specified by:
collectWithin interfaceUnsortedSetIterable<T>- Overrides:
collectWithin classAbstractCollectionAdapter<T>
-
zip
@Deprecated public <S> MutableSet<Pair<T,S>> zip(Iterable<S> that)
Deprecated.in 6.0. UseOrderedIterable.zip(Iterable)instead.- Specified by:
zipin interfaceMutableCollection<T>- Specified by:
zipin interfaceMutableSet<T>- Specified by:
zipin interfaceMutableSetIterable<T>- Specified by:
zipin interfaceRichIterable<T>- Specified by:
zipin interfaceUnsortedSetIterable<T>- Overrides:
zipin classAbstractCollectionAdapter<T>
-
zipWithIndex
@Deprecated public MutableSet<Pair<T,Integer>> zipWithIndex()
Deprecated.in 6.0. UseOrderedIterable.zipWithIndex()instead.- Specified by:
zipWithIndexin interfaceMutableCollection<T>- Specified by:
zipWithIndexin interfaceMutableSet<T>- Specified by:
zipWithIndexin interfaceMutableSetIterable<T>- Specified by:
zipWithIndexin interfaceRichIterable<T>- Specified by:
zipWithIndexin interfaceSetIterable<T>- Specified by:
zipWithIndexin interfaceUnsortedSetIterable<T>- Overrides:
zipWithIndexin classAbstractCollectionAdapter<T>
-
removeAllIterable
public boolean removeAllIterable(Iterable<?> iterable)
- Specified by:
removeAllIterablein interfaceMutableCollection<T>- Overrides:
removeAllIterablein classAbstractCollectionAdapter<T>
-
union
public MutableSet<T> union(SetIterable<? extends T> set)
- Specified by:
unionin interfaceMutableSet<T>- Specified by:
unionin interfaceSetIterable<T>- Specified by:
unionin interfaceUnsortedSetIterable<T>
-
unionInto
public <R extends Set<T>> R unionInto(SetIterable<? extends T> set, R targetSet)
- Specified by:
unionIntoin interfaceSetIterable<T>
-
intersect
public MutableSet<T> intersect(SetIterable<? extends T> set)
- Specified by:
intersectin interfaceMutableSet<T>- Specified by:
intersectin interfaceSetIterable<T>- Specified by:
intersectin interfaceUnsortedSetIterable<T>
-
intersectInto
public <R extends Set<T>> R intersectInto(SetIterable<? extends T> set, R targetSet)
- Specified by:
intersectIntoin interfaceSetIterable<T>
-
difference
public MutableSet<T> difference(SetIterable<? extends T> subtrahendSet)
- Specified by:
differencein interfaceMutableSet<T>- Specified by:
differencein interfaceSetIterable<T>- Specified by:
differencein interfaceUnsortedSetIterable<T>
-
differenceInto
public <R extends Set<T>> R differenceInto(SetIterable<? extends T> subtrahendSet, R targetSet)
- Specified by:
differenceIntoin interfaceSetIterable<T>
-
symmetricDifference
public MutableSet<T> symmetricDifference(SetIterable<? extends T> setB)
- Specified by:
symmetricDifferencein interfaceMutableSet<T>- Specified by:
symmetricDifferencein interfaceSetIterable<T>- Specified by:
symmetricDifferencein interfaceUnsortedSetIterable<T>
-
symmetricDifferenceInto
public <R extends Set<T>> R symmetricDifferenceInto(SetIterable<? extends T> set, R targetSet)
- Specified by:
symmetricDifferenceIntoin interfaceSetIterable<T>
-
isSubsetOf
public boolean isSubsetOf(SetIterable<? extends T> candidateSuperset)
- Specified by:
isSubsetOfin interfaceSetIterable<T>
-
isProperSubsetOf
public boolean isProperSubsetOf(SetIterable<? extends T> candidateSuperset)
- Specified by:
isProperSubsetOfin interfaceSetIterable<T>
-
powerSet
public MutableSet<UnsortedSetIterable<T>> powerSet()
- Specified by:
powerSetin interfaceMutableSet<T>- Specified by:
powerSetin interfaceUnsortedSetIterable<T>
-
cartesianProduct
public <B> LazyIterable<Pair<T,B>> cartesianProduct(SetIterable<B> set)
- Specified by:
cartesianProductin interfaceSetIterable<T>
-
asParallel
public ParallelUnsortedSetIterable<T> asParallel(ExecutorService executorService, int batchSize)
- Specified by:
asParallelin interfaceSetIterable<T>- Specified by:
asParallelin interfaceUnsortedSetIterable<T>
-
-