Class ImmutableEmptySetWithHashingStrategy<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.ImmutableEmptySetWithHashingStrategy<T>
- All Implemented Interfaces:
Serializable
,Iterable<T>
,Collection<T>
,Set<T>
,ImmutableCollection<T>
,InternalIterable<T>
,RichIterable<T>
,ImmutableSet<T>
,ImmutableSetIterable<T>
,SetIterable<T>
,UnsortedSetIterable<T>
final class ImmutableEmptySetWithHashingStrategy<T>
extends AbstractImmutableSet<T>
implements Serializable
This is a zero element
ImmutableUnifiedSetWithHashingStrategy
which is created by calling the HashingStrategySets.immutable.empty() method.-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.collections.impl.set.immutable.AbstractImmutableSet
AbstractImmutableSet.ImmutableSetIterator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HashingStrategy
<? super T> private static final long
-
Constructor Summary
ConstructorsConstructorDescriptionImmutableEmptySetWithHashingStrategy
(HashingStrategy<? super T> hashingStrategy) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if the iterable has an element which responds true to element.equals(object).void
The procedure is executed for each element in the iterable.boolean
Follows the same general contract asSet.equals(Object)
.<P> void
forEachWith
(Procedure2<? super T, ? super P> procedure, P parameter) The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.void
forEachWithIndex
(ObjectIntProcedure<? super T> objectIntProcedure) Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.getFirst()
Returns the first element of an iterable.getLast()
Returns the last element of an iterable.getOnly()
Returns the element if the iterable has exactly one element.int
hashCode()
Follows the same general contract asSet.hashCode()
.iterator()
max()
Returns the maximum element out of this container based on the natural order.max
(Comparator<? super T> comparator) Returns the maximum element out of this container based on the comparator.<V extends Comparable<? super V>>
TReturns the maximum elements out of this container based on the natural order of the attribute returned by Function.min()
Returns the minimum element out of this container based on the natural order.min
(Comparator<? super T> comparator) Returns the minimum element out of this container based on the comparator.<V extends Comparable<? super V>>
TReturns the minimum elements out of this container based on the natural order of the attribute returned by Function.This method is similar to thewith
method inMutableCollection
with the difference that a new copy of this collection with the element appended will be returned.newWithAll
(Iterable<? extends T> elements) This method is similar to thewithAll
method inMutableCollection
with the difference that a new copy of this collection with the elements appended will be returned.newWithout
(T element) This method is similar to thewithout
method inMutableCollection
with the difference that a new copy of this collection with the element removed will be returned.newWithoutAll
(Iterable<? extends T> elements) This method is similar to thewithoutAll
method inMutableCollection
with the difference that a new copy of this collection with the elements removed will be returned.int
size()
Returns the number of items in this iterable.private Object
<S,
R extends Collection<Pair<T, S>>>
RSame asRichIterable.zip(Iterable)
but usestarget
for output.<R extends Collection<Pair<T,
Integer>>>
RzipWithIndex
(R target) Same asRichIterable.zipWithIndex()
but usestarget
for output.Methods inherited from class org.eclipse.collections.impl.set.immutable.AbstractImmutableSet
asParallel, 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, 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, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, into, isEmpty, 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
Methods inherited from class java.lang.Object
clone, finalize, getClass, 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
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, maxByOptional, maxOptional, maxOptional, 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
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
hashingStrategy
-
-
Constructor Details
-
ImmutableEmptySetWithHashingStrategy
ImmutableEmptySetWithHashingStrategy(HashingStrategy<? super T> hashingStrategy)
-
-
Method Details
-
equals
Description copied from interface:SetIterable
Follows the same general contract asSet.equals(Object)
. -
hashCode
public int hashCode()Description copied from interface:SetIterable
Follows the same general contract asSet.hashCode()
. -
newWith
Description copied from interface:ImmutableCollection
This method is similar to thewith
method inMutableCollection
with the difference that a new copy of this collection with the element appended will be returned.- Specified by:
newWith
in interfaceImmutableCollection<T>
- Specified by:
newWith
in interfaceImmutableSet<T>
- Overrides:
newWith
in classAbstractImmutableSet<T>
-
newWithAll
Description copied from interface:ImmutableCollection
This method is similar to thewithAll
method inMutableCollection
with the difference that a new copy of this collection with the elements appended will be returned.- Specified by:
newWithAll
in interfaceImmutableCollection<T>
- Specified by:
newWithAll
in interfaceImmutableSet<T>
- Overrides:
newWithAll
in classAbstractImmutableSet<T>
-
newWithout
Description copied from interface:ImmutableCollection
This method is similar to thewithout
method inMutableCollection
with the difference that a new copy of this collection with the element removed will be returned.- Specified by:
newWithout
in interfaceImmutableCollection<T>
- Specified by:
newWithout
in interfaceImmutableSet<T>
- Overrides:
newWithout
in classAbstractImmutableSet<T>
-
newWithoutAll
Description copied from interface:ImmutableCollection
This method is similar to thewithoutAll
method inMutableCollection
with the difference that a new copy of this collection with the elements removed will be returned.- Specified by:
newWithoutAll
in interfaceImmutableCollection<T>
- Specified by:
newWithoutAll
in interfaceImmutableSet<T>
- Overrides:
newWithoutAll
in classAbstractImmutableSet<T>
-
size
public int size()Description copied from interface:RichIterable
Returns the number of items in this iterable.- Specified by:
size
in interfaceCollection<T>
- Specified by:
size
in interfaceRichIterable<T>
- Specified by:
size
in interfaceSet<T>
-
contains
Description copied from interface:RichIterable
Returns true if the iterable has an element which responds true to element.equals(object).- Specified by:
contains
in interfaceCollection<T>
- Specified by:
contains
in interfaceRichIterable<T>
- Specified by:
contains
in interfaceSet<T>
- Overrides:
contains
in classAbstractRichIterable<T>
-
each
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:
-
forEachWithIndex
Description copied from interface:InternalIterable
Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.Example using a Java 8 lambda:
people.forEachWithIndex((Person person, int index) -> LOGGER.info("Index: " + index + " person: " + person.getName()));
Example using an anonymous inner class:
people.forEachWithIndex(new ObjectIntProcedure<Person>() { public void value(Person person, int index) { LOGGER.info("Index: " + index + " person: " + person.getName()); } });
- Specified by:
forEachWithIndex
in interfaceInternalIterable<T>
- Overrides:
forEachWithIndex
in classAbstractRichIterable<T>
-
forEachWith
Description copied from interface:InternalIterable
The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.Example using a Java 8 lambda:
people.forEachWith((Person person, Person other) -> { if (person.isRelatedTo(other)) { LOGGER.info(person.getName()); } }, fred);
Example using an anonymous inner class:
people.forEachWith(new Procedure2<Person, Person>() { public void value(Person person, Person other) { if (person.isRelatedTo(other)) { LOGGER.info(person.getName()); } } }, fred);
- Specified by:
forEachWith
in interfaceInternalIterable<T>
- Overrides:
forEachWith
in classAbstractRichIterable<T>
-
iterator
-
min
Description copied from interface:RichIterable
Returns the minimum element out of this container based on the comparator.- Specified by:
min
in interfaceRichIterable<T>
- Overrides:
min
in classAbstractRichIterable<T>
-
max
Description copied from interface:RichIterable
Returns the maximum element out of this container based on the comparator.- Specified by:
max
in interfaceRichIterable<T>
- Overrides:
max
in classAbstractRichIterable<T>
-
min
Description copied from interface:RichIterable
Returns the minimum element out of this container based on the natural order.- Specified by:
min
in interfaceRichIterable<T>
- Overrides:
min
in classAbstractRichIterable<T>
-
max
Description copied from interface:RichIterable
Returns the maximum element out of this container based on the natural order.- Specified by:
max
in interfaceRichIterable<T>
- Overrides:
max
in classAbstractRichIterable<T>
-
minBy
Description copied from interface:RichIterable
Returns the minimum elements out of this container based on the natural order of the attribute returned by Function.- Specified by:
minBy
in interfaceRichIterable<T>
- Overrides:
minBy
in classAbstractRichIterable<T>
-
maxBy
Description copied from interface:RichIterable
Returns the maximum elements out of this container based on the natural order of the attribute returned by Function.- Specified by:
maxBy
in interfaceRichIterable<T>
- Overrides:
maxBy
in classAbstractRichIterable<T>
-
zip
Description copied from interface:RichIterable
Same asRichIterable.zip(Iterable)
but usestarget
for output.- Specified by:
zip
in interfaceRichIterable<T>
- Overrides:
zip
in classAbstractRichIterable<T>
-
zipWithIndex
Description copied from interface:RichIterable
Same asRichIterable.zipWithIndex()
but usestarget
for output.- Specified by:
zipWithIndex
in interfaceRichIterable<T>
- Overrides:
zipWithIndex
in classAbstractRichIterable<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
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
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.
-
writeReplace
-