Class DoubleHashSet
java.lang.Object
org.eclipse.collections.impl.primitive.AbstractDoubleIterable
org.eclipse.collections.impl.set.primitive.AbstractDoubleSet
org.eclipse.collections.impl.set.mutable.primitive.DoubleHashSet
- All Implemented Interfaces:
Externalizable, Serializable, MutableDoubleCollection, DoubleIterable, PrimitiveIterable, DoubleSet, MutableDoubleSet
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 doubleprivate static final intprivate static final intprivate intprivate intprivate static final doubleprivate static final longprivate double[]private intprivate int -
Constructor Summary
ConstructorsConstructorDescriptionDoubleHashSet(double... elements) DoubleHashSet(int initialCapacity) DoubleHashSet(DoubleIterable elements) -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(double element) booleanaddAll(double... source) booleanaddAll(DoubleIterable source) protected voidallocateTable(int sizeToAllocate) booleanallSatisfy(DoublePredicate predicate) Returns true if all of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.booleananySatisfy(DoublePredicate predicate) Returns true if any of the elements in the DoubleIterable 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(DoubleToObjectFunction<? 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(DoubleToObjectFunction<? extends V> function, R target) Same asDoubleIterable.collect(DoubleToObjectFunction), only the results are added to the target Collection.voidcompact()Deprecated.booleancontains(double value) Returns true if the value is contained in the DoubleIterable, and false if it is not.private voidintcount(DoublePredicate predicate) Returns a count of the number of elements in the DoubleIterable that return true for the specified predicate.doubledetectIfNone(DoublePredicate predicate, double ifNone) Returns a primitive iterator that can be used to iterate over the DoubleIterable in an imperative style.voideach(DoubleProcedure procedure) A synonym for forEach.freeze()Returns a frozen copy of this set.inthashCode()Follows the same general contract asSet.hashCode().<T> TinjectInto(T injectedValue, ObjectDoubleToObjectFunction<? super T, ? extends T> function) private static booleanisBetweenZeroAndThirtyOne(double value) private static booleanisNonSentinel(double value) private intmask(int spread) doublemax()private intdoublemin()newEmpty()Creates a new empty DoubleHashSet.static DoubleHashSetnewSet(DoubleIterable source) static DoubleHashSetnewSetWith(double... source) (package private) intprobe(double element) (package private) intprobeThree(double element, int removedIndex) (package private) intprobeTwo(double element, int removedIndex) voidprivate voidrehash(int newCapacity) private voidreject(DoublePredicate predicate) Returns a new DoubleIterable with all of the elements in the DoubleIterable that return false for the specified predicate.<R extends MutableDoubleCollection>
Rreject(DoublePredicate predicate, R target) Same asDoubleIterable.reject(DoublePredicate), only the results are added to the target MutableDoubleCollection.booleanremove(double value) booleanremoveAll(double... source) booleanremoveAll(DoubleIterable source) private booleanremoveZeroToThirtyOne(double value) booleanretainAll(double... source) booleanretainAll(DoubleIterable source) select(DoublePredicate predicate) Returns a new DoubleIterable with all of the elements in the DoubleIterable that return true for the specified predicate.<R extends MutableDoubleCollection>
Rselect(DoublePredicate predicate, R target) Same asDoubleIterable.select(DoublePredicate), only the results are added to the target MutableDoubleCollection.intsize()Returns the number of items in this iterable.private int(package private) intspreadAndMask(double element) (package private) intspreadTwoAndMask(double element) doublesum()double[]toArray()Converts the DoubleIterable to a primitive double array.double[]toArray(double[] array) Converts the DoubleIterable to a primitive double array.Returns an immutable copy of this set.booleanwith(double element) withAll(DoubleIterable elements) without(double element) withoutAll(DoubleIterable elements) voidMethods inherited from class AbstractDoubleSet
cartesianProduct, equalsMethods inherited from class AbstractDoubleIterable
asLazy, average, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toStringMethods inherited from interface DoubleIterable
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 DoubleSet
cartesianProduct, equals, isProperSubsetOf, isSubsetOf, tapMethods inherited from interface MutableDoubleCollection
removeIfMethods inherited from interface MutableDoubleSet
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 double EMPTY- See Also:
-
REMOVED
private static final double 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 double[] table -
occupiedWithData
private int occupiedWithData -
occupiedWithSentinels
private int occupiedWithSentinels -
zeroToThirtyOne
private int zeroToThirtyOne -
zeroToThirtyOneOccupied
private int zeroToThirtyOneOccupied -
copyOnWrite
private transient boolean copyOnWrite
-
-
Constructor Details
-
DoubleHashSet
public DoubleHashSet() -
DoubleHashSet
public DoubleHashSet(int initialCapacity) -
DoubleHashSet
public DoubleHashSet(double... elements) -
DoubleHashSet
-
DoubleHashSet
-
-
Method Details
-
boxed
- Specified by:
boxedin interfaceMutableDoubleSet
-
smallestPowerOfTwoGreaterThan
private int smallestPowerOfTwoGreaterThan(int n) -
newSet
-
newSetWith
-
isBetweenZeroAndThirtyOne
private static boolean isBetweenZeroAndThirtyOne(double value) -
hashCode
public int hashCode()Description copied from interface:DoubleSetFollows the same general contract asSet.hashCode().- Specified by:
hashCodein interfaceDoubleSet- Specified by:
hashCodein classAbstractDoubleSet
-
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(double element) - Specified by:
addin interfaceMutableDoubleCollection
-
addAll
public boolean addAll(double... source) - Specified by:
addAllin interfaceMutableDoubleCollection
-
addAll
- Specified by:
addAllin interfaceMutableDoubleCollection
-
remove
public boolean remove(double value) - Specified by:
removein interfaceMutableDoubleCollection
-
removeZeroToThirtyOne
private boolean removeZeroToThirtyOne(double value) -
removeAll
- Specified by:
removeAllin interfaceMutableDoubleCollection
-
removeAll
public boolean removeAll(double... source) - Specified by:
removeAllin interfaceMutableDoubleCollection
-
retainAll
- Specified by:
retainAllin interfaceMutableDoubleCollection- See Also:
-
retainAll
public boolean retainAll(double... source) - Specified by:
retainAllin interfaceMutableDoubleCollection- See Also:
-
clear
public void clear()- Specified by:
clearin interfaceMutableDoubleCollection
-
with
- Specified by:
within interfaceMutableDoubleCollection- Specified by:
within interfaceMutableDoubleSet
-
without
- Specified by:
withoutin interfaceMutableDoubleCollection- Specified by:
withoutin interfaceMutableDoubleSet
-
withAll
- Specified by:
withAllin interfaceMutableDoubleCollection- Specified by:
withAllin interfaceMutableDoubleSet
-
withoutAll
- Specified by:
withoutAllin interfaceMutableDoubleCollection- Specified by:
withoutAllin interfaceMutableDoubleSet
-
asUnmodifiable
- Specified by:
asUnmodifiablein interfaceMutableDoubleCollection- Specified by:
asUnmodifiablein interfaceMutableDoubleSet
-
asSynchronized
- Specified by:
asSynchronizedin interfaceMutableDoubleCollection- Specified by:
asSynchronizedin interfaceMutableDoubleSet
-
toImmutable
Description copied from interface:DoubleSetReturns an immutable copy of this set. If the set is immutable, it returns itself.- Specified by:
toImmutablein interfaceDoubleSet- Specified by:
toImmutablein interfaceMutableDoubleCollection- Specified by:
toImmutablein interfaceMutableDoubleSet
-
doubleIterator
Description copied from interface:DoubleIterableReturns a primitive iterator that can be used to iterate over the DoubleIterable in an imperative style.- Specified by:
doubleIteratorin interfaceDoubleIterable- Specified by:
doubleIteratorin interfaceMutableDoubleCollection
-
toArray
public double[] toArray()Description copied from interface:DoubleIterableConverts the DoubleIterable to a primitive double array.- Specified by:
toArrayin interfaceDoubleIterable
-
toArray
public double[] toArray(double[] array) Description copied from interface:DoubleIterableConverts the DoubleIterable to a primitive double 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 interfaceDoubleIterable
-
contains
public boolean contains(double value) Description copied from interface:DoubleIterableReturns true if the value is contained in the DoubleIterable, and false if it is not.- Specified by:
containsin interfaceDoubleIterable
-
each
Description copied from interface:DoubleIterableA synonym for forEach.- Specified by:
eachin interfaceDoubleIterable- Since:
- 7.0.
-
select
Description copied from interface:DoubleIterableReturns a new DoubleIterable with all of the elements in the DoubleIterable that return true for the specified predicate.- Specified by:
selectin interfaceDoubleIterable- Specified by:
selectin interfaceDoubleSet- Specified by:
selectin interfaceMutableDoubleCollection- Specified by:
selectin interfaceMutableDoubleSet
-
select
Description copied from interface:DoubleIterableSame asDoubleIterable.select(DoublePredicate), only the results are added to the target MutableDoubleCollection.- Specified by:
selectin interfaceDoubleIterable- Since:
- 8.1.
-
reject
Description copied from interface:DoubleIterableReturns a new DoubleIterable with all of the elements in the DoubleIterable that return false for the specified predicate.- Specified by:
rejectin interfaceDoubleIterable- Specified by:
rejectin interfaceDoubleSet- Specified by:
rejectin interfaceMutableDoubleCollection- Specified by:
rejectin interfaceMutableDoubleSet
-
reject
Description copied from interface:DoubleIterableSame asDoubleIterable.reject(DoublePredicate), only the results are added to the target MutableDoubleCollection.- Specified by:
rejectin interfaceDoubleIterable- Since:
- 8.1.
-
collect
Description copied from interface:DoubleIterableReturns 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 interfaceDoubleIterable- Specified by:
collectin interfaceDoubleSet- Specified by:
collectin interfaceMutableDoubleCollection- Specified by:
collectin interfaceMutableDoubleSet
-
collect
public <V, R extends Collection<V>> R collect(DoubleToObjectFunction<? extends V> function, R target) Description copied from interface:DoubleIterableSame asDoubleIterable.collect(DoubleToObjectFunction), only the results are added to the target Collection.- Specified by:
collectin interfaceDoubleIterable- Since:
- 8.1.
-
detectIfNone
- Specified by:
detectIfNonein interfaceDoubleIterable
-
count
Description copied from interface:DoubleIterableReturns a count of the number of elements in the DoubleIterable that return true for the specified predicate.- Specified by:
countin interfaceDoubleIterable
-
anySatisfy
Description copied from interface:DoubleIterableReturns true if any of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfyin interfaceDoubleIterable
-
allSatisfy
Description copied from interface:DoubleIterableReturns true if all of the elements in the DoubleIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfyin interfaceDoubleIterable
-
sum
public double sum()- Specified by:
sumin interfaceDoubleIterable
-
max
public double max()- Specified by:
maxin interfaceDoubleIterable
-
min
public double min()- Specified by:
minin interfaceDoubleIterable
-
freeze
Description copied from interface:DoubleSetReturns 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 interfaceDoubleSet- Specified by:
freezein interfaceMutableDoubleSet
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException
-
injectInto
public <T> T injectInto(T injectedValue, ObjectDoubleToObjectFunction<? super T, ? extends T> function) - Specified by:
injectIntoin interfaceDoubleIterable
-
chunk
Description copied from interface:DoubleIterablePartitions elements in fixed size chunks.- Specified by:
chunkin interfaceDoubleIterable- Parameters:
size- the number of elements per chunk- Returns:
- A
RichIterablecontainingDoubleIterables of sizesize, except the last will be truncated if the elements don't divide evenly.
-
newEmpty
Creates a new empty DoubleHashSet.- Specified by:
newEmptyin interfaceMutableDoubleCollection- Specified by:
newEmptyin interfaceMutableDoubleSet- 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(double element) -
probeTwo
int probeTwo(double element, int removedIndex) -
probeThree
int probeThree(double element, int removedIndex) -
spreadAndMask
int spreadAndMask(double element) -
spreadTwoAndMask
int spreadTwoAndMask(double element) -
mask
private int mask(int spread) -
copyTable
private void copyTable() -
maxOccupiedWithData
private int maxOccupiedWithData() -
isNonSentinel
private static boolean isNonSentinel(double value)
-
trimToSize()instead