public abstract class HashPrimitiveSet extends Object implements Serializable
HashIntSet
,
HashLongSet
,
HashDoubleSet
,
Serialized FormConstructor and Description |
---|
HashPrimitiveSet() |
Modifier and Type | Method and Description |
---|---|
protected static int |
findNextPositivePowerOfTwo(int value)
Returns the next power of 2 for the value that is greater than or equal to
the specified value.
|
protected static int |
hash(int value,
int mask)
Returns the hash for the specified value and mask.
|
protected static int |
nextIndex(int index,
int mask)
Returns the next index for the specified index and mask.
|
protected static int hash(int value, int mask)
value
- The value to be hashed.mask
- The mask to be applied (must be a power of 2, minus 1).protected static int nextIndex(int index, int mask)
index
- The index from which to calculate the next index.mask
- The mask to be applied (must be a power of 2, minus 1).protected static int findNextPositivePowerOfTwo(int value)
If value <= 0
, this method returns 1
.
Note: This method is not suitable for Integer.MIN_VALUE
or
numbers greater than 2^30
.
value
- Value from which to return the next power of 2.Copyright © 2020 LibJ. All rights reserved.