Class AbstractImmutableSet<T>
- java.lang.Object
-
- org.eclipse.collections.impl.AbstractRichIterable<T>
-
- org.eclipse.collections.impl.collection.immutable.AbstractImmutableCollection<T>
-
- org.eclipse.collections.impl.set.immutable.AbstractImmutableSet<T>
-
- All Implemented Interfaces:
Iterable<T>,Collection<T>,Set<T>,ImmutableCollection<T>,InternalIterable<T>,RichIterable<T>,ImmutableSet<T>,ImmutableSetIterable<T>,SetIterable<T>,UnsortedSetIterable<T>
public abstract class AbstractImmutableSet<T> extends AbstractImmutableCollection<T> implements ImmutableSet<T>, Set<T>
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.
-
-
Constructor Summary
Constructors Constructor Description AbstractImmutableSet()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ParallelUnsortedSetIterable<T>asParallel(ExecutorService executorService, int batchSize)<B> LazyIterable<Pair<T,B>>cartesianProduct(SetIterable<B> set)Set<T>castToSet()<V> ImmutableSet<V>collect(Function<? super T,? extends V> function)ImmutableBooleanSetcollectBoolean(BooleanFunction<? super T> booleanFunction)ImmutableByteSetcollectByte(ByteFunction<? super T> byteFunction)ImmutableCharSetcollectChar(CharFunction<? super T> charFunction)ImmutableDoubleSetcollectDouble(DoubleFunction<? super T> doubleFunction)ImmutableFloatSetcollectFloat(FloatFunction<? super T> floatFunction)<V> ImmutableSet<V>collectIf(Predicate<? super T> predicate, Function<? super T,? extends V> function)ImmutableIntSetcollectInt(IntFunction<? super T> intFunction)ImmutableLongSetcollectLong(LongFunction<? super T> longFunction)ImmutableShortSetcollectShort(ShortFunction<? super T> shortFunction)<P,V>
ImmutableSet<V>collectWith(Function2<? super T,? super P,? extends V> function, P parameter)ImmutableSet<T>difference(SetIterable<? extends T> subtrahendSet)<R extends Set<T>>
RdifferenceInto(SetIterable<? extends T> subtrahendSet, R targetSet)<V> ImmutableSet<V>flatCollect(Function<? super T,? extends Iterable<V>> function)<V> ImmutableSetMultimap<V,T>groupBy(Function<? super T,? extends V> function)<V,R extends MutableMultimap<V,T>>
RgroupBy(Function<? super T,? extends V> function, R target)<V> ImmutableSetMultimap<V,T>groupByEach(Function<? super T,? extends Iterable<V>> function)<V,R extends MutableMultimap<V,T>>
RgroupByEach(Function<? super T,? extends Iterable<V>> function, R target)ImmutableSet<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)ImmutableSet<T>newWith(T element)ImmutableSet<T>newWithAll(Iterable<? extends T> elements)ImmutableSet<T>newWithout(T element)ImmutableSet<T>newWithoutAll(Iterable<? extends T> elements)PartitionImmutableSet<T>partition(Predicate<? super T> predicate)<P> PartitionImmutableSet<T>partitionWith(Predicate2<? super T,? super P> predicate, P parameter)ImmutableSet<UnsortedSetIterable<T>>powerSet()ImmutableSet<T>reject(Predicate<? super T> predicate)<P> ImmutableSet<T>rejectWith(Predicate2<? super T,? super P> predicate, P parameter)ImmutableSet<T>select(Predicate<? super T> predicate)<S> ImmutableSet<S>selectInstancesOf(Class<S> clazz)<P> ImmutableSet<T>selectWith(Predicate2<? super T,? super P> predicate, P parameter)ImmutableSet<T>symmetricDifference(SetIterable<? extends T> setB)<R extends Set<T>>
RsymmetricDifferenceInto(SetIterable<? extends T> set, R targetSet)ImmutableSet<T>tap(Procedure<? super T> procedure)ImmutableSet<T>toImmutable()ImmutableSet<T>union(SetIterable<? extends T> set)<R extends Set<T>>
RunionInto(SetIterable<? extends T> set, R targetSet)<S> ImmutableSet<Pair<T,S>>zip(Iterable<S> that)Deprecated.in 6.0.ImmutableSet<Pair<T,Integer>>zipWithIndex()Deprecated.in 6.0.-
Methods inherited from class org.eclipse.collections.impl.collection.immutable.AbstractImmutableCollection
add, addAll, castToCollection, chunk, clear, countBy, countByEach, countByWith, groupByUniqueKey, parallelStream, reduce, remove, removeAll, retainAll, spliterator, stream, sumByDouble, sumByFloat, sumByInt, sumByLong
-
Methods inherited from class org.eclipse.collections.impl.AbstractRichIterable
allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, asLazy, collect, collectIf, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, countWith, detect, detectOptional, detectWith, detectWithIfNone, detectWithOptional, flatCollect, forEach, forEachWith, forEachWithIndex, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, into, isEmpty, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, reject, rejectWith, select, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toBiMap, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndex
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface org.eclipse.collections.api.collection.ImmutableCollection
aggregateBy, aggregateInPlaceBy, castToCollection, countBy, countByEach, countByWith, flatCollectWith, groupByUniqueKey, parallelStream, spliterator, stream, sumByDouble, sumByFloat, sumByInt, sumByLong
-
Methods inherited from interface org.eclipse.collections.api.set.ImmutableSet
flatCollectWith, toImmutableSet
-
Methods inherited from interface org.eclipse.collections.api.InternalIterable
forEach, forEachWith, forEachWithIndex
-
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, contains, containsAll, 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, groupByAndCollect, 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
-
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, spliterator, toArray, toArray
-
Methods inherited from interface org.eclipse.collections.api.set.SetIterable
equals, hashCode
-
-
-
-
Method Detail
-
castToSet
public Set<T> castToSet()
- Specified by:
castToSetin interfaceImmutableSet<T>
-
newWith
public ImmutableSet<T> newWith(T element)
- Specified by:
newWithin interfaceImmutableCollection<T>- Specified by:
newWithin interfaceImmutableSet<T>
-
newWithout
public ImmutableSet<T> newWithout(T element)
- Specified by:
newWithoutin interfaceImmutableCollection<T>- Specified by:
newWithoutin interfaceImmutableSet<T>
-
newWithAll
public ImmutableSet<T> newWithAll(Iterable<? extends T> elements)
- Specified by:
newWithAllin interfaceImmutableCollection<T>- Specified by:
newWithAllin interfaceImmutableSet<T>
-
newWithoutAll
public ImmutableSet<T> newWithoutAll(Iterable<? extends T> elements)
- Specified by:
newWithoutAllin interfaceImmutableCollection<T>- Specified by:
newWithoutAllin interfaceImmutableSet<T>
-
tap
public ImmutableSet<T> tap(Procedure<? super T> procedure)
- Specified by:
tapin interfaceImmutableCollection<T>- Specified by:
tapin interfaceImmutableSet<T>- Specified by:
tapin interfaceImmutableSetIterable<T>- Specified by:
tapin interfaceRichIterable<T>- Specified by:
tapin interfaceSetIterable<T>- Specified by:
tapin interfaceUnsortedSetIterable<T>
-
select
public ImmutableSet<T> select(Predicate<? super T> predicate)
- Specified by:
selectin interfaceImmutableCollection<T>- Specified by:
selectin interfaceImmutableSet<T>- Specified by:
selectin interfaceImmutableSetIterable<T>- Specified by:
selectin interfaceRichIterable<T>- Specified by:
selectin interfaceSetIterable<T>- Specified by:
selectin interfaceUnsortedSetIterable<T>
-
selectWith
public <P> ImmutableSet<T> selectWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
selectWithin interfaceImmutableCollection<T>- Specified by:
selectWithin interfaceImmutableSet<T>- Specified by:
selectWithin interfaceImmutableSetIterable<T>- Specified by:
selectWithin interfaceRichIterable<T>- Specified by:
selectWithin interfaceSetIterable<T>- Specified by:
selectWithin interfaceUnsortedSetIterable<T>
-
reject
public ImmutableSet<T> reject(Predicate<? super T> predicate)
- Specified by:
rejectin interfaceImmutableCollection<T>- Specified by:
rejectin interfaceImmutableSet<T>- Specified by:
rejectin interfaceImmutableSetIterable<T>- Specified by:
rejectin interfaceRichIterable<T>- Specified by:
rejectin interfaceSetIterable<T>- Specified by:
rejectin interfaceUnsortedSetIterable<T>
-
rejectWith
public <P> ImmutableSet<T> rejectWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
rejectWithin interfaceImmutableCollection<T>- Specified by:
rejectWithin interfaceImmutableSet<T>- Specified by:
rejectWithin interfaceImmutableSetIterable<T>- Specified by:
rejectWithin interfaceRichIterable<T>- Specified by:
rejectWithin interfaceSetIterable<T>- Specified by:
rejectWithin interfaceUnsortedSetIterable<T>
-
partition
public PartitionImmutableSet<T> partition(Predicate<? super T> predicate)
- Specified by:
partitionin interfaceImmutableCollection<T>- Specified by:
partitionin interfaceImmutableSet<T>- Specified by:
partitionin interfaceImmutableSetIterable<T>- Specified by:
partitionin interfaceRichIterable<T>- Specified by:
partitionin interfaceSetIterable<T>
-
partitionWith
public <P> PartitionImmutableSet<T> partitionWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
partitionWithin interfaceImmutableCollection<T>- Specified by:
partitionWithin interfaceImmutableSet<T>- Specified by:
partitionWithin interfaceImmutableSetIterable<T>- Specified by:
partitionWithin interfaceRichIterable<T>- Specified by:
partitionWithin interfaceSetIterable<T>
-
selectInstancesOf
public <S> ImmutableSet<S> selectInstancesOf(Class<S> clazz)
- Specified by:
selectInstancesOfin interfaceImmutableCollection<T>- Specified by:
selectInstancesOfin interfaceImmutableSet<T>- Specified by:
selectInstancesOfin interfaceImmutableSetIterable<T>- Specified by:
selectInstancesOfin interfaceRichIterable<T>- Specified by:
selectInstancesOfin interfaceSetIterable<T>- Specified by:
selectInstancesOfin interfaceUnsortedSetIterable<T>
-
collect
public <V> ImmutableSet<V> collect(Function<? super T,? extends V> function)
- Specified by:
collectin interfaceImmutableCollection<T>- Specified by:
collectin interfaceImmutableSet<T>- Specified by:
collectin interfaceRichIterable<T>- Specified by:
collectin interfaceUnsortedSetIterable<T>
-
collectBoolean
public ImmutableBooleanSet collectBoolean(BooleanFunction<? super T> booleanFunction)
- Specified by:
collectBooleanin interfaceImmutableCollection<T>- Specified by:
collectBooleanin interfaceImmutableSet<T>- Specified by:
collectBooleanin interfaceRichIterable<T>- Specified by:
collectBooleanin interfaceUnsortedSetIterable<T>
-
collectByte
public ImmutableByteSet collectByte(ByteFunction<? super T> byteFunction)
- Specified by:
collectBytein interfaceImmutableCollection<T>- Specified by:
collectBytein interfaceImmutableSet<T>- Specified by:
collectBytein interfaceRichIterable<T>- Specified by:
collectBytein interfaceUnsortedSetIterable<T>
-
collectChar
public ImmutableCharSet collectChar(CharFunction<? super T> charFunction)
- Specified by:
collectCharin interfaceImmutableCollection<T>- Specified by:
collectCharin interfaceImmutableSet<T>- Specified by:
collectCharin interfaceRichIterable<T>- Specified by:
collectCharin interfaceUnsortedSetIterable<T>
-
collectDouble
public ImmutableDoubleSet collectDouble(DoubleFunction<? super T> doubleFunction)
- Specified by:
collectDoublein interfaceImmutableCollection<T>- Specified by:
collectDoublein interfaceImmutableSet<T>- Specified by:
collectDoublein interfaceRichIterable<T>- Specified by:
collectDoublein interfaceUnsortedSetIterable<T>
-
collectFloat
public ImmutableFloatSet collectFloat(FloatFunction<? super T> floatFunction)
- Specified by:
collectFloatin interfaceImmutableCollection<T>- Specified by:
collectFloatin interfaceImmutableSet<T>- Specified by:
collectFloatin interfaceRichIterable<T>- Specified by:
collectFloatin interfaceUnsortedSetIterable<T>
-
collectInt
public ImmutableIntSet collectInt(IntFunction<? super T> intFunction)
- Specified by:
collectIntin interfaceImmutableCollection<T>- Specified by:
collectIntin interfaceImmutableSet<T>- Specified by:
collectIntin interfaceRichIterable<T>- Specified by:
collectIntin interfaceUnsortedSetIterable<T>
-
collectLong
public ImmutableLongSet collectLong(LongFunction<? super T> longFunction)
- Specified by:
collectLongin interfaceImmutableCollection<T>- Specified by:
collectLongin interfaceImmutableSet<T>- Specified by:
collectLongin interfaceRichIterable<T>- Specified by:
collectLongin interfaceUnsortedSetIterable<T>
-
collectShort
public ImmutableShortSet collectShort(ShortFunction<? super T> shortFunction)
- Specified by:
collectShortin interfaceImmutableCollection<T>- Specified by:
collectShortin interfaceImmutableSet<T>- Specified by:
collectShortin interfaceRichIterable<T>- Specified by:
collectShortin interfaceUnsortedSetIterable<T>
-
collectWith
public <P,V> ImmutableSet<V> collectWith(Function2<? super T,? super P,? extends V> function, P parameter)
- Specified by:
collectWithin interfaceImmutableCollection<T>- Specified by:
collectWithin interfaceImmutableSet<T>- Specified by:
collectWithin interfaceRichIterable<T>- Specified by:
collectWithin interfaceUnsortedSetIterable<T>
-
collectIf
public <V> ImmutableSet<V> collectIf(Predicate<? super T> predicate, Function<? super T,? extends V> function)
- Specified by:
collectIfin interfaceImmutableCollection<T>- Specified by:
collectIfin interfaceImmutableSet<T>- Specified by:
collectIfin interfaceRichIterable<T>- Specified by:
collectIfin interfaceUnsortedSetIterable<T>
-
flatCollect
public <V> ImmutableSet<V> flatCollect(Function<? super T,? extends Iterable<V>> function)
- Specified by:
flatCollectin interfaceImmutableCollection<T>- Specified by:
flatCollectin interfaceImmutableSet<T>- Specified by:
flatCollectin interfaceRichIterable<T>- Specified by:
flatCollectin interfaceUnsortedSetIterable<T>
-
toImmutable
public ImmutableSet<T> toImmutable()
- Specified by:
toImmutablein interfaceSetIterable<T>- Specified by:
toImmutablein interfaceUnsortedSetIterable<T>
-
groupBy
public <V> ImmutableSetMultimap<V,T> groupBy(Function<? super T,? extends V> function)
- Specified by:
groupByin interfaceImmutableCollection<T>- Specified by:
groupByin interfaceImmutableSet<T>- Specified by:
groupByin interfaceImmutableSetIterable<T>- Specified by:
groupByin interfaceRichIterable<T>- Specified by:
groupByin interfaceUnsortedSetIterable<T>
-
groupBy
public <V,R extends MutableMultimap<V,T>> R groupBy(Function<? super T,? extends V> function, R target)
- Specified by:
groupByin interfaceRichIterable<T>- Overrides:
groupByin classAbstractRichIterable<T>
-
groupByEach
public <V> ImmutableSetMultimap<V,T> groupByEach(Function<? super T,? extends Iterable<V>> function)
- Specified by:
groupByEachin interfaceImmutableCollection<T>- Specified by:
groupByEachin interfaceImmutableSet<T>- Specified by:
groupByEachin interfaceImmutableSetIterable<T>- Specified by:
groupByEachin interfaceRichIterable<T>- Specified by:
groupByEachin interfaceUnsortedSetIterable<T>
-
groupByEach
public <V,R extends MutableMultimap<V,T>> R groupByEach(Function<? super T,? extends Iterable<V>> function, R target)
- Specified by:
groupByEachin interfaceRichIterable<T>- Overrides:
groupByEachin classAbstractRichIterable<T>
-
zip
@Deprecated public <S> ImmutableSet<Pair<T,S>> zip(Iterable<S> that)
Deprecated.in 6.0. UseOrderedIterable.zip(Iterable)instead.- Specified by:
zipin interfaceImmutableCollection<T>- Specified by:
zipin interfaceImmutableSet<T>- Specified by:
zipin interfaceRichIterable<T>- Specified by:
zipin interfaceUnsortedSetIterable<T>
-
zipWithIndex
@Deprecated public ImmutableSet<Pair<T,Integer>> zipWithIndex()
Deprecated.in 6.0. UseOrderedIterable.zipWithIndex()instead.- Specified by:
zipWithIndexin interfaceImmutableCollection<T>- Specified by:
zipWithIndexin interfaceImmutableSet<T>- Specified by:
zipWithIndexin interfaceImmutableSetIterable<T>- Specified by:
zipWithIndexin interfaceRichIterable<T>- Specified by:
zipWithIndexin interfaceSetIterable<T>- Specified by:
zipWithIndexin interfaceUnsortedSetIterable<T>
-
union
public ImmutableSet<T> union(SetIterable<? extends T> set)
- Specified by:
unionin interfaceImmutableSet<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 ImmutableSet<T> intersect(SetIterable<? extends T> set)
- Specified by:
intersectin interfaceImmutableSet<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 ImmutableSet<T> difference(SetIterable<? extends T> subtrahendSet)
- Specified by:
differencein interfaceImmutableSet<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 ImmutableSet<T> symmetricDifference(SetIterable<? extends T> setB)
- Specified by:
symmetricDifferencein interfaceImmutableSet<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 ImmutableSet<UnsortedSetIterable<T>> powerSet()
- Specified by:
powerSetin interfaceImmutableSet<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>
-
-