goldman.collection.set
Interface Hasher<E>
- All Known Implementing Classes:
- DirectAddressing.DirectAddressingHasher, OpenAddressing.DefaultOpenAddressingHasher, SeparateChaining.DefaultSeparateChainingHasher
public interface Hasher<E>
The Hasher
interface provides the application program the
flexibility to specify how the hash codes are to be computed over the elements of
the set.
getHashCode
int getHashCode(E element)
- Parameters:
element
- the element for which the hash code should be computed
- Returns:
- the hash code for the given element, which may not necessarily be
related to the
element.hashCode
getTableSize
int getTableSize(int capacity,
double load)
- Parameters:
capacity
- the desired capacity of the collectionload
- the desired load factor of the table
- Returns:
- the proper table size in accordance with the hashing algorithm and
the way hash codes are computed