Class ImmutableUnifiedSetWithHashingStrategy<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>
-
- org.eclipse.collections.impl.set.strategy.immutable.ImmutableUnifiedSetWithHashingStrategy<T>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Iterable<T>
,java.util.Collection<T>
,java.util.Set<T>
,ImmutableCollection<T>
,InternalIterable<T>
,RichIterable<T>
,ImmutableSet<T>
,ImmutableSetIterable<T>
,SetIterable<T>
,UnsortedSetIterable<T>
,BatchIterable<T>
final class ImmutableUnifiedSetWithHashingStrategy<T> extends AbstractImmutableSet<T> implements java.io.Serializable, BatchIterable<T>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.collections.impl.set.immutable.AbstractImmutableSet
AbstractImmutableSet.ImmutableSetIterator
-
-
Field Summary
Fields Modifier and Type Field Description private UnifiedSetWithHashingStrategy<T>
delegate
private static long
serialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description private
ImmutableUnifiedSetWithHashingStrategy(UnifiedSetWithHashingStrategy<T> delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ParallelUnsortedSetIterable<T>
asParallel(java.util.concurrent.ExecutorService executorService, int batchSize)
Returns a parallel iterable of this SetIterable.void
batchForEach(Procedure<? super T> procedure, int sectionIndex, int sectionCount)
boolean
contains(java.lang.Object object)
Returns true if the iterable has an element which responds true to element.equals(object).void
each(Procedure<? super T> procedure)
The procedure is executed for each element in the iterable.boolean
equals(java.lang.Object other)
Follows the same general contract asSet.equals(Object)
.int
getBatchCount(int batchSize)
T
getFirst()
Returns the first element of an iterable.T
getLast()
Returns the last element of an iterable.T
getOnly()
Returns the element if the iterable has exactly one element.int
hashCode()
Follows the same general contract asSet.hashCode()
.java.util.Iterator<T>
iterator()
static <T> ImmutableSet<T>
newSet(HashingStrategy<? super T> hashingStrategy, int capacity)
static <T> ImmutableSet<T>
newSet(HashingStrategy<? super T> hashingStrategy, java.lang.Iterable<? extends T> iterable)
static <T> ImmutableSet<T>
newSetWith(HashingStrategy<? super T> hashingStrategy, T... elements)
int
size()
Returns the number of items in this iterable.private java.lang.Object
writeReplace()
-
Methods inherited from class org.eclipse.collections.impl.set.immutable.AbstractImmutableSet
cartesianProduct, castToSet, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, difference, differenceInto, flatCollect, groupBy, groupBy, groupByEach, groupByEach, intersect, intersectInto, isProperSubsetOf, isSubsetOf, newMutable, newWith, newWithAll, newWithout, newWithoutAll, nullSafeHashCode, partition, partitionWith, powerSet, reject, rejectWith, select, selectInstancesOf, selectWith, symmetricDifference, symmetricDifferenceInto, tap, toImmutable, union, unionInto, zip, zipWithIndex
-
Methods inherited from class org.eclipse.collections.impl.collection.immutable.AbstractImmutableCollection
add, addAll, castToCollection, chunk, clear, countBy, countByEach, countByWith, groupByUniqueKey, parallelStream, reduce, remove, removeAll, removeAllFrom, 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, 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
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.collections.impl.parallel.BatchIterable
forEach
-
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, containsAll, containsAllArguments, containsAllIterable, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, count, countBy, countByEach, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, 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, 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
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
delegate
private final UnifiedSetWithHashingStrategy<T> delegate
-
-
Constructor Detail
-
ImmutableUnifiedSetWithHashingStrategy
private ImmutableUnifiedSetWithHashingStrategy(UnifiedSetWithHashingStrategy<T> delegate)
-
-
Method Detail
-
newSetWith
public static <T> ImmutableSet<T> newSetWith(HashingStrategy<? super T> hashingStrategy, T... elements)
-
newSet
public static <T> ImmutableSet<T> newSet(HashingStrategy<? super T> hashingStrategy, java.lang.Iterable<? extends T> iterable)
-
newSet
public static <T> ImmutableSet<T> newSet(HashingStrategy<? super T> hashingStrategy, int capacity)
-
size
public int size()
Description copied from interface:RichIterable
Returns the number of items in this iterable.- Specified by:
size
in interfaceBatchIterable<T>
- Specified by:
size
in interfacejava.util.Collection<T>
- Specified by:
size
in interfaceRichIterable<T>
- Specified by:
size
in interfacejava.util.Set<T>
-
equals
public boolean equals(java.lang.Object other)
Description copied from interface:SetIterable
Follows the same general contract asSet.equals(Object)
.- Specified by:
equals
in interfacejava.util.Collection<T>
- Specified by:
equals
in interfacejava.util.Set<T>
- Specified by:
equals
in interfaceSetIterable<T>
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
Description copied from interface:SetIterable
Follows the same general contract asSet.hashCode()
.- Specified by:
hashCode
in interfacejava.util.Collection<T>
- Specified by:
hashCode
in interfacejava.util.Set<T>
- Specified by:
hashCode
in interfaceSetIterable<T>
- Overrides:
hashCode
in classjava.lang.Object
-
contains
public boolean contains(java.lang.Object object)
Description copied from interface:RichIterable
Returns true if the iterable has an element which responds true to element.equals(object).- Specified by:
contains
in interfacejava.util.Collection<T>
- Specified by:
contains
in interfaceRichIterable<T>
- Specified by:
contains
in interfacejava.util.Set<T>
- Overrides:
contains
in classAbstractRichIterable<T>
-
iterator
public java.util.Iterator<T> iterator()
-
getFirst
public T getFirst()
Description copied from interface:RichIterable
Returns the first element of an iterable. In the case of a List it is the element at the first index. In the case of any other Collection, it is the first element that would be returned during an iteration. If the iterable is empty, null is returned. If null is a valid element of the container, then a developer would need to check to see if the iterable is empty to validate that a null result was not due to the container being empty.The order of Sets are not guaranteed (except for TreeSets and other Ordered Set implementations), so if you use this method, the first element could be any element from the Set.
- Specified by:
getFirst
in interfaceRichIterable<T>
-
getLast
public T getLast()
Description copied from interface:RichIterable
Returns the last element of an iterable. In the case of a List it is the element at the last index. In the case of any other Collection, it is the last element that would be returned during an iteration. If the iterable is empty, null is returned. If null is a valid element of the container, then a developer would need to check to see if the iterable is empty to validate that a null result was not due to the container being empty.The order of Sets are not guaranteed (except for TreeSets and other Ordered Set implementations), so if you use this method, the last element could be any element from the Set.
- Specified by:
getLast
in interfaceRichIterable<T>
-
getOnly
public T getOnly()
Description copied from interface:RichIterable
Returns the element if the iterable has exactly one element. Otherwise, throwIllegalStateException
.- Specified by:
getOnly
in interfaceRichIterable<T>
- Returns:
- an element of an iterable.
-
each
public void each(Procedure<? super T> procedure)
Description copied from interface:RichIterable
The procedure is executed for each element in the iterable.Example using a Java 8 lambda expression:
people.each(person -> LOGGER.info(person.getName()));
Example using an anonymous inner class:
people.each(new Procedure<Person>() { public void value(Person person) { LOGGER.info(person.getName()); } });
This method is a variant ofInternalIterable.forEach(Procedure)
that has a signature conflict withIterable.forEach(java.util.function.Consumer)
.- Specified by:
each
in interfaceRichIterable<T>
- See Also:
InternalIterable.forEach(Procedure)
,Iterable.forEach(java.util.function.Consumer)
-
getBatchCount
public int getBatchCount(int batchSize)
- Specified by:
getBatchCount
in interfaceBatchIterable<T>
-
batchForEach
public void batchForEach(Procedure<? super T> procedure, int sectionIndex, int sectionCount)
- Specified by:
batchForEach
in interfaceBatchIterable<T>
-
writeReplace
private java.lang.Object writeReplace()
-
asParallel
public ParallelUnsortedSetIterable<T> asParallel(java.util.concurrent.ExecutorService executorService, int batchSize)
Description copied from interface:SetIterable
Returns a parallel iterable of this SetIterable.- Specified by:
asParallel
in interfaceSetIterable<T>
- Specified by:
asParallel
in interfaceUnsortedSetIterable<T>
- Overrides:
asParallel
in classAbstractImmutableSet<T>
-
-