Class FloatHashSet
java.lang.Object
org.eclipse.collections.impl.primitive.AbstractFloatIterable
org.eclipse.collections.impl.set.primitive.AbstractFloatSet
org.eclipse.collections.impl.set.mutable.primitive.FloatHashSet
- All Implemented Interfaces:
Externalizable, Serializable, MutableFloatCollection, FloatIterable, PrimitiveIterable, FloatSet, MutableFloatSet
This file was automatically generated from template file primitiveHashSet.stg.
- Since:
- 3.0.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classprivate class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate booleanprivate static final intprivate static final floatprivate static final intprivate static final intprivate intprivate intprivate static final floatprivate static final longprivate float[]private intprivate int -
Constructor Summary
ConstructorsConstructorDescriptionFloatHashSet(float... elements) FloatHashSet(int initialCapacity) FloatHashSet(FloatIterable elements) FloatHashSet(FloatHashSet set) -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(float element) booleanaddAll(float... source) booleanaddAll(FloatIterable source) protected voidallocateTable(int sizeToAllocate) booleanallSatisfy(FloatPredicate predicate) Returns true if all of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.booleananySatisfy(FloatPredicate predicate) Returns true if any of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.voidappendString(Appendable appendable, String start, String separator, String end) Prints a string representation of this collection onto the givenAppendable.boxed()chunk(int size) Partitions elements in fixed size chunks.voidclear()<V> MutableSet<V> collect(FloatToObjectFunction<? extends V> function) Returns a new collection with the results of applying the specified function on each element of the source collection.<V, R extends Collection<V>>
Rcollect(FloatToObjectFunction<? extends V> function, R target) Same asFloatIterable.collect(FloatToObjectFunction), only the results are added to the target Collection.voidcompact()Deprecated.booleancontains(float value) Returns true if the value is contained in the FloatIterable, and false if it is not.private voidintcount(FloatPredicate predicate) Returns a count of the number of elements in the FloatIterable that return true for the specified predicate.floatdetectIfNone(FloatPredicate predicate, float ifNone) voideach(FloatProcedure procedure) A synonym for forEach.Returns a primitive iterator that can be used to iterate over the FloatIterable in an imperative style.freeze()Returns a frozen copy of this set.inthashCode()Follows the same general contract asSet.hashCode().<T> TinjectInto(T injectedValue, ObjectFloatToObjectFunction<? super T, ? extends T> function) private static booleanisBetweenZeroAndThirtyOne(float value) private static booleanisNonSentinel(float value) private intmask(int spread) floatmax()private intfloatmin()newEmpty()Creates a new empty FloatHashSet.static FloatHashSetnewSet(FloatIterable source) static FloatHashSetnewSetWith(float... source) (package private) intprobe(float element) (package private) intprobeThree(float element, int removedIndex) (package private) intprobeTwo(float element, int removedIndex) voidprivate voidrehash(int newCapacity) private voidreject(FloatPredicate predicate) Returns a new FloatIterable with all of the elements in the FloatIterable that return false for the specified predicate.<R extends MutableFloatCollection>
Rreject(FloatPredicate predicate, R target) Same asFloatIterable.reject(FloatPredicate), only the results are added to the target MutableFloatCollection.booleanremove(float value) booleanremoveAll(float... source) booleanremoveAll(FloatIterable source) private booleanremoveZeroToThirtyOne(float value) booleanretainAll(float... source) booleanretainAll(FloatIterable source) select(FloatPredicate predicate) Returns a new FloatIterable with all of the elements in the FloatIterable that return true for the specified predicate.<R extends MutableFloatCollection>
Rselect(FloatPredicate predicate, R target) Same asFloatIterable.select(FloatPredicate), only the results are added to the target MutableFloatCollection.intsize()Returns the number of items in this iterable.private int(package private) intspreadAndMask(float element) (package private) intspreadTwoAndMask(float element) doublesum()float[]toArray()Converts the FloatIterable to a primitive float array.float[]toArray(float[] array) Converts the FloatIterable to a primitive float array.Returns an immutable copy of this set.booleanwith(float element) withAll(FloatIterable elements) without(float element) withoutAll(FloatIterable elements) voidMethods inherited from class AbstractFloatSet
cartesianProduct, equalsMethods inherited from class AbstractFloatIterable
asLazy, average, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toStringMethods inherited from interface FloatIterable
asLazy, average, averageIfEmpty, 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, noneSatisfy, reduce, reduceIfEmpty, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedList, toSortedList, toSortedListBy, toSortedListByMethods inherited from interface FloatSet
cartesianProduct, equals, isProperSubsetOf, isSubsetOf, tapMethods inherited from interface MutableFloatCollection
removeIfMethods inherited from interface MutableFloatSet
difference, intersect, symmetricDifference, tap, unionMethods inherited from interface PrimitiveIterable
appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
DEFAULT_INITIAL_CAPACITY
private static final int DEFAULT_INITIAL_CAPACITY- See Also:
-
EMPTY
private static final float EMPTY- See Also:
-
REMOVED
private static final float REMOVED- See Also:
-
CACHE_LINE_SIZE
private static final int CACHE_LINE_SIZE- See Also:
-
KEY_SIZE
private static final int KEY_SIZE- See Also:
-
INITIAL_LINEAR_PROBE
private static final int INITIAL_LINEAR_PROBE- See Also:
-
table
private float[] table -
occupiedWithData
private int occupiedWithData -
occupiedWithSentinels
private int occupiedWithSentinels -
zeroToThirtyOne
private int zeroToThirtyOne -
zeroToThirtyOneOccupied
private int zeroToThirtyOneOccupied -
copyOnWrite
private transient boolean copyOnWrite
-
-
Constructor Details
-
FloatHashSet
public FloatHashSet() -
FloatHashSet
public FloatHashSet(int initialCapacity) -
FloatHashSet
public FloatHashSet(float... elements) -
FloatHashSet
-
FloatHashSet
-
-
Method Details
-
boxed
- Specified by:
boxedin interfaceMutableFloatSet
-
smallestPowerOfTwoGreaterThan
private int smallestPowerOfTwoGreaterThan(int n) -
newSet
-
newSetWith
-
isBetweenZeroAndThirtyOne
private static boolean isBetweenZeroAndThirtyOne(float value) -
hashCode
public int hashCode()Description copied from interface:FloatSetFollows the same general contract asSet.hashCode().- Specified by:
hashCodein interfaceFloatSet- Specified by:
hashCodein classAbstractFloatSet
-
size
public int size()Description copied from interface:PrimitiveIterableReturns the number of items in this iterable.- Specified by:
sizein interfacePrimitiveIterable
-
appendString
Description copied from interface:PrimitiveIterablePrints a string representation of this collection onto the givenAppendable. Prints the string returned byPrimitiveIterable.makeString(String, String, String).- Specified by:
appendStringin interfacePrimitiveIterable
-
add
public boolean add(float element) - Specified by:
addin interfaceMutableFloatCollection
-
addAll
public boolean addAll(float... source) - Specified by:
addAllin interfaceMutableFloatCollection
-
addAll
- Specified by:
addAllin interfaceMutableFloatCollection
-
remove
public boolean remove(float value) - Specified by:
removein interfaceMutableFloatCollection
-
removeZeroToThirtyOne
private boolean removeZeroToThirtyOne(float value) -
removeAll
- Specified by:
removeAllin interfaceMutableFloatCollection
-
removeAll
public boolean removeAll(float... source) - Specified by:
removeAllin interfaceMutableFloatCollection
-
retainAll
- Specified by:
retainAllin interfaceMutableFloatCollection- See Also:
-
retainAll
public boolean retainAll(float... source) - Specified by:
retainAllin interfaceMutableFloatCollection- See Also:
-
clear
public void clear()- Specified by:
clearin interfaceMutableFloatCollection
-
with
- Specified by:
within interfaceMutableFloatCollection- Specified by:
within interfaceMutableFloatSet
-
without
- Specified by:
withoutin interfaceMutableFloatCollection- Specified by:
withoutin interfaceMutableFloatSet
-
withAll
- Specified by:
withAllin interfaceMutableFloatCollection- Specified by:
withAllin interfaceMutableFloatSet
-
withoutAll
- Specified by:
withoutAllin interfaceMutableFloatCollection- Specified by:
withoutAllin interfaceMutableFloatSet
-
asUnmodifiable
- Specified by:
asUnmodifiablein interfaceMutableFloatCollection- Specified by:
asUnmodifiablein interfaceMutableFloatSet
-
asSynchronized
- Specified by:
asSynchronizedin interfaceMutableFloatCollection- Specified by:
asSynchronizedin interfaceMutableFloatSet
-
toImmutable
Description copied from interface:FloatSetReturns an immutable copy of this set. If the set is immutable, it returns itself.- Specified by:
toImmutablein interfaceFloatSet- Specified by:
toImmutablein interfaceMutableFloatCollection- Specified by:
toImmutablein interfaceMutableFloatSet
-
floatIterator
Description copied from interface:FloatIterableReturns a primitive iterator that can be used to iterate over the FloatIterable in an imperative style.- Specified by:
floatIteratorin interfaceFloatIterable- Specified by:
floatIteratorin interfaceMutableFloatCollection
-
toArray
public float[] toArray()Description copied from interface:FloatIterableConverts the FloatIterable to a primitive float array.- Specified by:
toArrayin interfaceFloatIterable
-
toArray
public float[] toArray(float[] array) Description copied from interface:FloatIterableConverts the FloatIterable to a primitive float 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:
toArrayin interfaceFloatIterable
-
contains
public boolean contains(float value) Description copied from interface:FloatIterableReturns true if the value is contained in the FloatIterable, and false if it is not.- Specified by:
containsin interfaceFloatIterable
-
each
Description copied from interface:FloatIterableA synonym for forEach.- Specified by:
eachin interfaceFloatIterable- Since:
- 7.0.
-
select
Description copied from interface:FloatIterableReturns a new FloatIterable with all of the elements in the FloatIterable that return true for the specified predicate.- Specified by:
selectin interfaceFloatIterable- Specified by:
selectin interfaceFloatSet- Specified by:
selectin interfaceMutableFloatCollection- Specified by:
selectin interfaceMutableFloatSet
-
select
Description copied from interface:FloatIterableSame asFloatIterable.select(FloatPredicate), only the results are added to the target MutableFloatCollection.- Specified by:
selectin interfaceFloatIterable- Since:
- 8.1.
-
reject
Description copied from interface:FloatIterableReturns a new FloatIterable with all of the elements in the FloatIterable that return false for the specified predicate.- Specified by:
rejectin interfaceFloatIterable- Specified by:
rejectin interfaceFloatSet- Specified by:
rejectin interfaceMutableFloatCollection- Specified by:
rejectin interfaceMutableFloatSet
-
reject
Description copied from interface:FloatIterableSame asFloatIterable.reject(FloatPredicate), only the results are added to the target MutableFloatCollection.- Specified by:
rejectin interfaceFloatIterable- Since:
- 8.1.
-
collect
Description copied from interface:FloatIterableReturns 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:
collectin interfaceFloatIterable- Specified by:
collectin interfaceFloatSet- Specified by:
collectin interfaceMutableFloatCollection- Specified by:
collectin interfaceMutableFloatSet
-
collect
public <V, R extends Collection<V>> R collect(FloatToObjectFunction<? extends V> function, R target) Description copied from interface:FloatIterableSame asFloatIterable.collect(FloatToObjectFunction), only the results are added to the target Collection.- Specified by:
collectin interfaceFloatIterable- Since:
- 8.1.
-
detectIfNone
- Specified by:
detectIfNonein interfaceFloatIterable
-
count
Description copied from interface:FloatIterableReturns a count of the number of elements in the FloatIterable that return true for the specified predicate.- Specified by:
countin interfaceFloatIterable
-
anySatisfy
Description copied from interface:FloatIterableReturns true if any of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfyin interfaceFloatIterable
-
allSatisfy
Description copied from interface:FloatIterableReturns true if all of the elements in the FloatIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfyin interfaceFloatIterable
-
sum
public double sum()- Specified by:
sumin interfaceFloatIterable
-
max
public float max()- Specified by:
maxin interfaceFloatIterable
-
min
public float min()- Specified by:
minin interfaceFloatIterable
-
freeze
Description copied from interface:FloatSetReturns a frozen copy of this set. If the set is frozen, it returns itself. A frozen copy is the same thing as an immutable copy without safe-publish guarantees.- Specified by:
freezein interfaceFloatSet- Specified by:
freezein interfaceMutableFloatSet
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException
-
injectInto
public <T> T injectInto(T injectedValue, ObjectFloatToObjectFunction<? super T, ? extends T> function) - Specified by:
injectIntoin interfaceFloatIterable
-
chunk
Description copied from interface:FloatIterablePartitions elements in fixed size chunks.- Specified by:
chunkin interfaceFloatIterable- Parameters:
size- the number of elements per chunk- Returns:
- A
RichIterablecontainingFloatIterables of sizesize, except the last will be truncated if the elements don't divide evenly.
-
newEmpty
Creates a new empty FloatHashSet.- Specified by:
newEmptyin interfaceMutableFloatCollection- Specified by:
newEmptyin interfaceMutableFloatSet- Since:
- 9.2.
-
trimToSize
public boolean trimToSize()- Since:
- 12.0
-
compact
Deprecated.since 12.0 - UsetrimToSize()insteadRehashes every element in the set into a new backing table of the smallest possible size and eliminating removed sentinels. -
rehashAndGrow
private void rehashAndGrow() -
rehash
private void rehash(int newCapacity) -
allocateTable
protected void allocateTable(int sizeToAllocate) -
probe
int probe(float element) -
probeTwo
int probeTwo(float element, int removedIndex) -
probeThree
int probeThree(float element, int removedIndex) -
spreadAndMask
int spreadAndMask(float element) -
spreadTwoAndMask
int spreadTwoAndMask(float element) -
mask
private int mask(int spread) -
copyTable
private void copyTable() -
maxOccupiedWithData
private int maxOccupiedWithData() -
isNonSentinel
private static boolean isNonSentinel(float value)
-
trimToSize()instead