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)
ImmutableBooleanSet
collectBoolean(BooleanFunction<? super T> booleanFunction)
ImmutableByteSet
collectByte(ByteFunction<? super T> byteFunction)
ImmutableCharSet
collectChar(CharFunction<? super T> charFunction)
ImmutableDoubleSet
collectDouble(DoubleFunction<? super T> doubleFunction)
ImmutableFloatSet
collectFloat(FloatFunction<? super T> floatFunction)
<V> ImmutableSet<V>
collectIf(Predicate<? super T> predicate, Function<? super T,? extends V> function)
ImmutableIntSet
collectInt(IntFunction<? super T> intFunction)
ImmutableLongSet
collectLong(LongFunction<? super T> longFunction)
ImmutableShortSet
collectShort(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)
boolean
isProperSubsetOf(SetIterable<? extends T> candidateSuperset)
boolean
isSubsetOf(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:
castToSet
in interfaceImmutableSet<T>
-
newWith
public ImmutableSet<T> newWith(T element)
- Specified by:
newWith
in interfaceImmutableCollection<T>
- Specified by:
newWith
in interfaceImmutableSet<T>
-
newWithout
public ImmutableSet<T> newWithout(T element)
- Specified by:
newWithout
in interfaceImmutableCollection<T>
- Specified by:
newWithout
in interfaceImmutableSet<T>
-
newWithAll
public ImmutableSet<T> newWithAll(Iterable<? extends T> elements)
- Specified by:
newWithAll
in interfaceImmutableCollection<T>
- Specified by:
newWithAll
in interfaceImmutableSet<T>
-
newWithoutAll
public ImmutableSet<T> newWithoutAll(Iterable<? extends T> elements)
- Specified by:
newWithoutAll
in interfaceImmutableCollection<T>
- Specified by:
newWithoutAll
in interfaceImmutableSet<T>
-
tap
public ImmutableSet<T> tap(Procedure<? super T> procedure)
- Specified by:
tap
in interfaceImmutableCollection<T>
- Specified by:
tap
in interfaceImmutableSet<T>
- Specified by:
tap
in interfaceImmutableSetIterable<T>
- Specified by:
tap
in interfaceRichIterable<T>
- Specified by:
tap
in interfaceSetIterable<T>
- Specified by:
tap
in interfaceUnsortedSetIterable<T>
-
select
public ImmutableSet<T> select(Predicate<? super T> predicate)
- Specified by:
select
in interfaceImmutableCollection<T>
- Specified by:
select
in interfaceImmutableSet<T>
- Specified by:
select
in interfaceImmutableSetIterable<T>
- Specified by:
select
in interfaceRichIterable<T>
- Specified by:
select
in interfaceSetIterable<T>
- Specified by:
select
in interfaceUnsortedSetIterable<T>
-
selectWith
public <P> ImmutableSet<T> selectWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
selectWith
in interfaceImmutableCollection<T>
- Specified by:
selectWith
in interfaceImmutableSet<T>
- Specified by:
selectWith
in interfaceImmutableSetIterable<T>
- Specified by:
selectWith
in interfaceRichIterable<T>
- Specified by:
selectWith
in interfaceSetIterable<T>
- Specified by:
selectWith
in interfaceUnsortedSetIterable<T>
-
reject
public ImmutableSet<T> reject(Predicate<? super T> predicate)
- Specified by:
reject
in interfaceImmutableCollection<T>
- Specified by:
reject
in interfaceImmutableSet<T>
- Specified by:
reject
in interfaceImmutableSetIterable<T>
- Specified by:
reject
in interfaceRichIterable<T>
- Specified by:
reject
in interfaceSetIterable<T>
- Specified by:
reject
in interfaceUnsortedSetIterable<T>
-
rejectWith
public <P> ImmutableSet<T> rejectWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
rejectWith
in interfaceImmutableCollection<T>
- Specified by:
rejectWith
in interfaceImmutableSet<T>
- Specified by:
rejectWith
in interfaceImmutableSetIterable<T>
- Specified by:
rejectWith
in interfaceRichIterable<T>
- Specified by:
rejectWith
in interfaceSetIterable<T>
- Specified by:
rejectWith
in interfaceUnsortedSetIterable<T>
-
partition
public PartitionImmutableSet<T> partition(Predicate<? super T> predicate)
- Specified by:
partition
in interfaceImmutableCollection<T>
- Specified by:
partition
in interfaceImmutableSet<T>
- Specified by:
partition
in interfaceImmutableSetIterable<T>
- Specified by:
partition
in interfaceRichIterable<T>
- Specified by:
partition
in interfaceSetIterable<T>
-
partitionWith
public <P> PartitionImmutableSet<T> partitionWith(Predicate2<? super T,? super P> predicate, P parameter)
- Specified by:
partitionWith
in interfaceImmutableCollection<T>
- Specified by:
partitionWith
in interfaceImmutableSet<T>
- Specified by:
partitionWith
in interfaceImmutableSetIterable<T>
- Specified by:
partitionWith
in interfaceRichIterable<T>
- Specified by:
partitionWith
in interfaceSetIterable<T>
-
selectInstancesOf
public <S> ImmutableSet<S> selectInstancesOf(Class<S> clazz)
- Specified by:
selectInstancesOf
in interfaceImmutableCollection<T>
- Specified by:
selectInstancesOf
in interfaceImmutableSet<T>
- Specified by:
selectInstancesOf
in interfaceImmutableSetIterable<T>
- Specified by:
selectInstancesOf
in interfaceRichIterable<T>
- Specified by:
selectInstancesOf
in interfaceSetIterable<T>
- Specified by:
selectInstancesOf
in interfaceUnsortedSetIterable<T>
-
collect
public <V> ImmutableSet<V> collect(Function<? super T,? extends V> function)
- Specified by:
collect
in interfaceImmutableCollection<T>
- Specified by:
collect
in interfaceImmutableSet<T>
- Specified by:
collect
in interfaceRichIterable<T>
- Specified by:
collect
in interfaceUnsortedSetIterable<T>
-
collectBoolean
public ImmutableBooleanSet collectBoolean(BooleanFunction<? super T> booleanFunction)
- Specified by:
collectBoolean
in interfaceImmutableCollection<T>
- Specified by:
collectBoolean
in interfaceImmutableSet<T>
- Specified by:
collectBoolean
in interfaceRichIterable<T>
- Specified by:
collectBoolean
in interfaceUnsortedSetIterable<T>
-
collectByte
public ImmutableByteSet collectByte(ByteFunction<? super T> byteFunction)
- Specified by:
collectByte
in interfaceImmutableCollection<T>
- Specified by:
collectByte
in interfaceImmutableSet<T>
- Specified by:
collectByte
in interfaceRichIterable<T>
- Specified by:
collectByte
in interfaceUnsortedSetIterable<T>
-
collectChar
public ImmutableCharSet collectChar(CharFunction<? super T> charFunction)
- Specified by:
collectChar
in interfaceImmutableCollection<T>
- Specified by:
collectChar
in interfaceImmutableSet<T>
- Specified by:
collectChar
in interfaceRichIterable<T>
- Specified by:
collectChar
in interfaceUnsortedSetIterable<T>
-
collectDouble
public ImmutableDoubleSet collectDouble(DoubleFunction<? super T> doubleFunction)
- Specified by:
collectDouble
in interfaceImmutableCollection<T>
- Specified by:
collectDouble
in interfaceImmutableSet<T>
- Specified by:
collectDouble
in interfaceRichIterable<T>
- Specified by:
collectDouble
in interfaceUnsortedSetIterable<T>
-
collectFloat
public ImmutableFloatSet collectFloat(FloatFunction<? super T> floatFunction)
- Specified by:
collectFloat
in interfaceImmutableCollection<T>
- Specified by:
collectFloat
in interfaceImmutableSet<T>
- Specified by:
collectFloat
in interfaceRichIterable<T>
- Specified by:
collectFloat
in interfaceUnsortedSetIterable<T>
-
collectInt
public ImmutableIntSet collectInt(IntFunction<? super T> intFunction)
- Specified by:
collectInt
in interfaceImmutableCollection<T>
- Specified by:
collectInt
in interfaceImmutableSet<T>
- Specified by:
collectInt
in interfaceRichIterable<T>
- Specified by:
collectInt
in interfaceUnsortedSetIterable<T>
-
collectLong
public ImmutableLongSet collectLong(LongFunction<? super T> longFunction)
- Specified by:
collectLong
in interfaceImmutableCollection<T>
- Specified by:
collectLong
in interfaceImmutableSet<T>
- Specified by:
collectLong
in interfaceRichIterable<T>
- Specified by:
collectLong
in interfaceUnsortedSetIterable<T>
-
collectShort
public ImmutableShortSet collectShort(ShortFunction<? super T> shortFunction)
- Specified by:
collectShort
in interfaceImmutableCollection<T>
- Specified by:
collectShort
in interfaceImmutableSet<T>
- Specified by:
collectShort
in interfaceRichIterable<T>
- Specified by:
collectShort
in interfaceUnsortedSetIterable<T>
-
collectWith
public <P,V> ImmutableSet<V> collectWith(Function2<? super T,? super P,? extends V> function, P parameter)
- Specified by:
collectWith
in interfaceImmutableCollection<T>
- Specified by:
collectWith
in interfaceImmutableSet<T>
- Specified by:
collectWith
in interfaceRichIterable<T>
- Specified by:
collectWith
in interfaceUnsortedSetIterable<T>
-
collectIf
public <V> ImmutableSet<V> collectIf(Predicate<? super T> predicate, Function<? super T,? extends V> function)
- Specified by:
collectIf
in interfaceImmutableCollection<T>
- Specified by:
collectIf
in interfaceImmutableSet<T>
- Specified by:
collectIf
in interfaceRichIterable<T>
- Specified by:
collectIf
in interfaceUnsortedSetIterable<T>
-
flatCollect
public <V> ImmutableSet<V> flatCollect(Function<? super T,? extends Iterable<V>> function)
- Specified by:
flatCollect
in interfaceImmutableCollection<T>
- Specified by:
flatCollect
in interfaceImmutableSet<T>
- Specified by:
flatCollect
in interfaceRichIterable<T>
- Specified by:
flatCollect
in interfaceUnsortedSetIterable<T>
-
toImmutable
public ImmutableSet<T> toImmutable()
- Specified by:
toImmutable
in interfaceSetIterable<T>
- Specified by:
toImmutable
in interfaceUnsortedSetIterable<T>
-
groupBy
public <V> ImmutableSetMultimap<V,T> groupBy(Function<? super T,? extends V> function)
- Specified by:
groupBy
in interfaceImmutableCollection<T>
- Specified by:
groupBy
in interfaceImmutableSet<T>
- Specified by:
groupBy
in interfaceImmutableSetIterable<T>
- Specified by:
groupBy
in interfaceRichIterable<T>
- Specified by:
groupBy
in interfaceUnsortedSetIterable<T>
-
groupBy
public <V,R extends MutableMultimap<V,T>> R groupBy(Function<? super T,? extends V> function, R target)
- Specified by:
groupBy
in interfaceRichIterable<T>
- Overrides:
groupBy
in classAbstractRichIterable<T>
-
groupByEach
public <V> ImmutableSetMultimap<V,T> groupByEach(Function<? super T,? extends Iterable<V>> function)
- Specified by:
groupByEach
in interfaceImmutableCollection<T>
- Specified by:
groupByEach
in interfaceImmutableSet<T>
- Specified by:
groupByEach
in interfaceImmutableSetIterable<T>
- Specified by:
groupByEach
in interfaceRichIterable<T>
- Specified by:
groupByEach
in interfaceUnsortedSetIterable<T>
-
groupByEach
public <V,R extends MutableMultimap<V,T>> R groupByEach(Function<? super T,? extends Iterable<V>> function, R target)
- Specified by:
groupByEach
in interfaceRichIterable<T>
- Overrides:
groupByEach
in classAbstractRichIterable<T>
-
zip
@Deprecated public <S> ImmutableSet<Pair<T,S>> zip(Iterable<S> that)
Deprecated.in 6.0. UseOrderedIterable.zip(Iterable)
instead.- Specified by:
zip
in interfaceImmutableCollection<T>
- Specified by:
zip
in interfaceImmutableSet<T>
- Specified by:
zip
in interfaceRichIterable<T>
- Specified by:
zip
in interfaceUnsortedSetIterable<T>
-
zipWithIndex
@Deprecated public ImmutableSet<Pair<T,Integer>> zipWithIndex()
Deprecated.in 6.0. UseOrderedIterable.zipWithIndex()
instead.- Specified by:
zipWithIndex
in interfaceImmutableCollection<T>
- Specified by:
zipWithIndex
in interfaceImmutableSet<T>
- Specified by:
zipWithIndex
in interfaceImmutableSetIterable<T>
- Specified by:
zipWithIndex
in interfaceRichIterable<T>
- Specified by:
zipWithIndex
in interfaceSetIterable<T>
- Specified by:
zipWithIndex
in interfaceUnsortedSetIterable<T>
-
union
public ImmutableSet<T> union(SetIterable<? extends T> set)
- Specified by:
union
in interfaceImmutableSet<T>
- Specified by:
union
in interfaceSetIterable<T>
- Specified by:
union
in interfaceUnsortedSetIterable<T>
-
unionInto
public <R extends Set<T>> R unionInto(SetIterable<? extends T> set, R targetSet)
- Specified by:
unionInto
in interfaceSetIterable<T>
-
intersect
public ImmutableSet<T> intersect(SetIterable<? extends T> set)
- Specified by:
intersect
in interfaceImmutableSet<T>
- Specified by:
intersect
in interfaceSetIterable<T>
- Specified by:
intersect
in interfaceUnsortedSetIterable<T>
-
intersectInto
public <R extends Set<T>> R intersectInto(SetIterable<? extends T> set, R targetSet)
- Specified by:
intersectInto
in interfaceSetIterable<T>
-
difference
public ImmutableSet<T> difference(SetIterable<? extends T> subtrahendSet)
- Specified by:
difference
in interfaceImmutableSet<T>
- Specified by:
difference
in interfaceSetIterable<T>
- Specified by:
difference
in interfaceUnsortedSetIterable<T>
-
differenceInto
public <R extends Set<T>> R differenceInto(SetIterable<? extends T> subtrahendSet, R targetSet)
- Specified by:
differenceInto
in interfaceSetIterable<T>
-
symmetricDifference
public ImmutableSet<T> symmetricDifference(SetIterable<? extends T> setB)
- Specified by:
symmetricDifference
in interfaceImmutableSet<T>
- Specified by:
symmetricDifference
in interfaceSetIterable<T>
- Specified by:
symmetricDifference
in interfaceUnsortedSetIterable<T>
-
symmetricDifferenceInto
public <R extends Set<T>> R symmetricDifferenceInto(SetIterable<? extends T> set, R targetSet)
- Specified by:
symmetricDifferenceInto
in interfaceSetIterable<T>
-
isSubsetOf
public boolean isSubsetOf(SetIterable<? extends T> candidateSuperset)
- Specified by:
isSubsetOf
in interfaceSetIterable<T>
-
isProperSubsetOf
public boolean isProperSubsetOf(SetIterable<? extends T> candidateSuperset)
- Specified by:
isProperSubsetOf
in interfaceSetIterable<T>
-
powerSet
public ImmutableSet<UnsortedSetIterable<T>> powerSet()
- Specified by:
powerSet
in interfaceImmutableSet<T>
- Specified by:
powerSet
in interfaceUnsortedSetIterable<T>
-
cartesianProduct
public <B> LazyIterable<Pair<T,B>> cartesianProduct(SetIterable<B> set)
- Specified by:
cartesianProduct
in interfaceSetIterable<T>
-
asParallel
public ParallelUnsortedSetIterable<T> asParallel(ExecutorService executorService, int batchSize)
- Specified by:
asParallel
in interfaceSetIterable<T>
- Specified by:
asParallel
in interfaceUnsortedSetIterable<T>
-
-