Class ShortHashSet.ImmutableShortHashSet
- java.lang.Object
-
- org.eclipse.collections.impl.primitive.AbstractShortIterable
-
- org.eclipse.collections.impl.set.primitive.AbstractShortSet
-
- org.eclipse.collections.impl.set.immutable.primitive.AbstractImmutableShortSet
-
- org.eclipse.collections.impl.set.mutable.primitive.ShortHashSet.ImmutableShortHashSet
-
- All Implemented Interfaces:
java.io.Serializable
,ImmutableShortCollection
,PrimitiveIterable
,ImmutableShortSet
,ShortSet
,ShortIterable
- Enclosing class:
- ShortHashSet
private static final class ShortHashSet.ImmutableShortHashSet extends AbstractImmutableShortSet implements java.io.Serializable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
ShortHashSet.ImmutableShortHashSet.InternalShortIterator
-
Field Summary
Fields Modifier and Type Field Description private int
occupied
private static long
serialVersionUID
private short[]
table
private int
zeroToThirtyOne
private int
zeroToThirtyOneOccupied
-
Constructor Summary
Constructors Modifier Constructor Description private
ImmutableShortHashSet(short[] table, int occupied, int zeroToThirtyOne, int zeroToThirtyOneOccupied)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allSatisfy(ShortPredicate predicate)
Returns true if all of the elements in the ShortIterable return true for the specified predicate, otherwise returns false.boolean
anySatisfy(ShortPredicate predicate)
Returns true if any of the elements in the ShortIterable return true for the specified predicate, otherwise returns false.void
appendString(java.lang.Appendable appendable, java.lang.String start, java.lang.String separator, java.lang.String end)
Prints a string representation of this collection onto the givenAppendable
.private void
checkOptimizedSize(int length)
<V> ImmutableSet<V>
collect(ShortToObjectFunction<? extends V> function)
Returns a new collection with the results of applying the specified function on each element of the source collection.boolean
contains(short value)
Returns true if the value is contained in the ShortIterable, and false if it is not.int
count(ShortPredicate predicate)
Returns a count of the number of elements in the ShortIterable that return true for the specified predicate.short
detectIfNone(ShortPredicate predicate, short ifNone)
void
each(ShortProcedure procedure)
A synonym for forEach.int
hashCode()
Follows the same general contract asSet.hashCode()
.<T> T
injectInto(T injectedValue, ObjectShortToObjectFunction<? super T,? extends T> function)
private int
mask(int spread)
short
max()
short
min()
static ImmutableShortSet
newSetWith(short... elements)
boolean
noneSatisfy(ShortPredicate predicate)
Returns true if none of the elements in the ShortIterable return true for the specified predicate, otherwise returns false.(package private) int
probe(short element)
(package private) int
probeThree(short element, int removedIndex)
(package private) int
probeTwo(short element, int removedIndex)
ImmutableShortSet
reject(ShortPredicate predicate)
Returns a new ShortIterable with all of the elements in the ShortIterable that return false for the specified predicate.ImmutableShortSet
select(ShortPredicate predicate)
Returns a new ShortIterable with all of the elements in the ShortIterable that return true for the specified predicate.ShortIterator
shortIterator()
Returns a primitive iterator that can be used to iterate over the ShortIterable in an imperative style.int
size()
Returns the number of items in this iterable.(package private) int
spreadAndMask(short element)
(package private) int
spreadTwoAndMask(short element)
long
sum()
short[]
toArray()
Converts the ShortIterable to a primitive short array.short[]
toArray(short[] array)
Converts the ShortIterable to a primitive short array.private java.lang.Object
writeReplace()
-
Methods inherited from class org.eclipse.collections.impl.set.immutable.primitive.AbstractImmutableShortSet
chunk, freeze, newWith, newWithAll, newWithout, newWithoutAll, toImmutable
-
Methods inherited from class org.eclipse.collections.impl.set.primitive.AbstractShortSet
cartesianProduct, equals
-
Methods inherited from class org.eclipse.collections.impl.primitive.AbstractShortIterable
asLazy, average, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.collections.api.set.primitive.ImmutableShortSet
difference, intersect, symmetricDifference, tap, union
-
Methods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, toString
-
Methods inherited from interface org.eclipse.collections.api.ShortIterable
asLazy, average, averageIfEmpty, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAll, containsAll, containsAny, containsAny, containsNone, containsNone, flatCollect, forEach, injectIntoBoolean, injectIntoByte, injectIntoChar, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, injectIntoShort, maxIfEmpty, median, medianIfEmpty, minIfEmpty, reduce, reduceIfEmpty, reject, select, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedList, toSortedList, toSortedListBy, toSortedListBy
-
Methods inherited from interface org.eclipse.collections.api.set.primitive.ShortSet
cartesianProduct, equals, isProperSubsetOf, isSubsetOf, tap
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
table
private final short[] table
-
occupied
private final int occupied
-
zeroToThirtyOne
private final int zeroToThirtyOne
-
zeroToThirtyOneOccupied
private final int zeroToThirtyOneOccupied
-
-
Method Detail
-
checkOptimizedSize
private void checkOptimizedSize(int length)
-
newSetWith
public static ImmutableShortSet newSetWith(short... elements)
-
hashCode
public int hashCode()
Description copied from interface:ShortSet
Follows the same general contract asSet.hashCode()
.- Specified by:
hashCode
in interfaceShortSet
- Specified by:
hashCode
in classAbstractShortSet
-
size
public int size()
Description copied from interface:PrimitiveIterable
Returns the number of items in this iterable.- Specified by:
size
in interfacePrimitiveIterable
-
appendString
public void appendString(java.lang.Appendable appendable, java.lang.String start, java.lang.String separator, java.lang.String end)
Description copied from interface:PrimitiveIterable
Prints a string representation of this collection onto the givenAppendable
. Prints the string returned byPrimitiveIterable.makeString(String, String, String)
.- Specified by:
appendString
in interfacePrimitiveIterable
-
shortIterator
public ShortIterator shortIterator()
Description copied from interface:ShortIterable
Returns a primitive iterator that can be used to iterate over the ShortIterable in an imperative style.- Specified by:
shortIterator
in interfaceShortIterable
-
toArray
public short[] toArray()
Description copied from interface:ShortIterable
Converts the ShortIterable to a primitive short array.- Specified by:
toArray
in interfaceShortIterable
-
toArray
public short[] toArray(short[] array)
Description copied from interface:ShortIterable
Converts the ShortIterable to a primitive short array. If the collection fits into the provided array it is used to store its elements and is returned from the method, otherwise a new array of the appropriate size is allocated and returned. If the iterable is empty, the target array is returned unchanged.- Specified by:
toArray
in interfaceShortIterable
-
contains
public boolean contains(short value)
Description copied from interface:ShortIterable
Returns true if the value is contained in the ShortIterable, and false if it is not.- Specified by:
contains
in interfaceShortIterable
-
each
public void each(ShortProcedure procedure)
Description copied from interface:ShortIterable
A synonym for forEach.- Specified by:
each
in interfaceShortIterable
-
select
public ImmutableShortSet select(ShortPredicate predicate)
Description copied from interface:ShortIterable
Returns a new ShortIterable with all of the elements in the ShortIterable that return true for the specified predicate.- Specified by:
select
in interfaceImmutableShortCollection
- Specified by:
select
in interfaceImmutableShortSet
- Specified by:
select
in interfaceShortIterable
- Specified by:
select
in interfaceShortSet
-
reject
public ImmutableShortSet reject(ShortPredicate predicate)
Description copied from interface:ShortIterable
Returns a new ShortIterable with all of the elements in the ShortIterable that return false for the specified predicate.- Specified by:
reject
in interfaceImmutableShortCollection
- Specified by:
reject
in interfaceImmutableShortSet
- Specified by:
reject
in interfaceShortIterable
- Specified by:
reject
in interfaceShortSet
-
collect
public <V> ImmutableSet<V> collect(ShortToObjectFunction<? extends V> function)
Description copied from interface:ShortIterable
Returns a new collection with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.- Specified by:
collect
in interfaceImmutableShortCollection
- Specified by:
collect
in interfaceImmutableShortSet
- Specified by:
collect
in interfaceShortIterable
- Specified by:
collect
in interfaceShortSet
-
detectIfNone
public short detectIfNone(ShortPredicate predicate, short ifNone)
- Specified by:
detectIfNone
in interfaceShortIterable
-
count
public int count(ShortPredicate predicate)
Description copied from interface:ShortIterable
Returns a count of the number of elements in the ShortIterable that return true for the specified predicate.- Specified by:
count
in interfaceShortIterable
-
anySatisfy
public boolean anySatisfy(ShortPredicate predicate)
Description copied from interface:ShortIterable
Returns true if any of the elements in the ShortIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfy
in interfaceShortIterable
-
allSatisfy
public boolean allSatisfy(ShortPredicate predicate)
Description copied from interface:ShortIterable
Returns true if all of the elements in the ShortIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfy
in interfaceShortIterable
-
noneSatisfy
public boolean noneSatisfy(ShortPredicate predicate)
Description copied from interface:ShortIterable
Returns true if none of the elements in the ShortIterable return true for the specified predicate, otherwise returns false.- Specified by:
noneSatisfy
in interfaceShortIterable
-
sum
public long sum()
- Specified by:
sum
in interfaceShortIterable
-
max
public short max()
- Specified by:
max
in interfaceShortIterable
-
min
public short min()
- Specified by:
min
in interfaceShortIterable
-
injectInto
public <T> T injectInto(T injectedValue, ObjectShortToObjectFunction<? super T,? extends T> function)
- Specified by:
injectInto
in interfaceShortIterable
-
writeReplace
private java.lang.Object writeReplace()
-
probe
int probe(short element)
-
probeTwo
int probeTwo(short element, int removedIndex)
-
probeThree
int probeThree(short element, int removedIndex)
-
spreadAndMask
int spreadAndMask(short element)
-
spreadTwoAndMask
int spreadTwoAndMask(short element)
-
mask
private int mask(int spread)
-
-