Interface HashCollection<E>
- All Superinterfaces:
Sized
- All Known Implementing Classes:
ConstHashEnum
,ConstHashTable
,ConstHashTable.Keys
,EqConstHashEnum
,EqConstHashTable
,EqConstHashTable.Keys
,EqHashEnum
,EqHashTable
,EqHashTable.Keys
,HashEnum
,HashTable
,HashTable.Keys
public interface HashCollection<E> extends Sized
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
HashCollection.Analysis<H>
-
Field Summary
Fields Modifier and Type Field Description static float
DEFAULT_HASH_FACTOR
static int
DEFAULT_HASH_LENGTH
-
Method Summary
Modifier and Type Method Description HashCollection.Analysis<? extends HashCollection<E>>
analyze()
float
hashDensity()
int
hashDistributionRange()
HashEqualator<? super E>
hashEquality()
boolean
hasVolatileHashElements()
int
rehash()
Recalculates the hash value of all entries and reorginazes and optimizes the hash storage accordingly.void
setHashDensity(float hashDensity)
Sets the hash density (1/density) of this hashing collection if applicable.long
size()
-
Field Details
-
DEFAULT_HASH_FACTOR
static final float DEFAULT_HASH_FACTOR- See Also:
- Constant Field Values
-
DEFAULT_HASH_LENGTH
static final int DEFAULT_HASH_LENGTH- See Also:
- Constant Field Values
-
-
Method Details
-
hashDensity
float hashDensity() -
setHashDensity
void setHashDensity(float hashDensity)Sets the hash density (1/density) of this hashing collection if applicable.If this procedure is not applicable for the hash collection (e.g. an immutable hash collection), calling this method has no effect.
- Parameters:
hashDensity
- the new hash density to be set.- Throws:
IllegalArgumentException
- if the passed value would have an effect but is less than or equal to 0.
-
hashEquality
HashEqualator<? super E> hashEquality() -
analyze
HashCollection.Analysis<? extends HashCollection<E>> analyze() -
hasVolatileHashElements
boolean hasVolatileHashElements() -
hashDistributionRange
int hashDistributionRange() -
size
long size() -
rehash
int rehash()Recalculates the hash value of all entries and reorginazes and optimizes the hash storage accordingly. This method is meant for cases where a hash collection has to collect its elements before proper hash values can be derived for them or where hash mutable elements can change their hash-relevant state after having been added (and hashed) in a hash collection. Note that depending on the hash-relevant state of elements and their changing of it, it can be possible that some elements oust others, thus decreasing the collection's size. This behavior depends on the type of the elements and the used hash logic and cannot be compensated by a general purpose collection implementation.- Returns:
- the new size of the collection which might be lower than before the call.
-