Package pixy.util
Class IntHashtable<E>
java.lang.Object
pixy.util.IntHashtable<E>
public class IntHashtable<E>
extends java.lang.Object
A hash table using primitive integer keys.
- Version:
- 1.0 01/06/2008
Based on
QuadraticProbingHashTable.java
Probing table implementation of hash tables. Note that all "matching" is based on the equals method.
- Author:
- Wen Yu, yuwen_66@yahoo.com, Mark Allen Weiss
-
Constructor Summary
Constructors Constructor Description IntHashtable()
Construct the hash table.IntHashtable(int size)
Construct the hash table. -
Method Summary
Modifier and Type Method Description boolean
contains(int key)
Search for an item in the hash table.E
get(int key)
Find an item in the hash table.static void
main(java.lang.String[] args)
void
makeEmpty()
Make the hash table logically empty.void
put(int key, E value)
Insert into the hash table.void
remove(int key)
Remove from the hash table.
-
Constructor Details
-
IntHashtable
public IntHashtable()Construct the hash table. -
IntHashtable
public IntHashtable(int size)Construct the hash table.- Parameters:
size
- the approximate initial size.
-
-
Method Details
-
put
Insert into the hash table. If the item is already present, do nothing.- Parameters:
key
- the item to insert.
-
remove
public void remove(int key)Remove from the hash table.- Parameters:
key
- the item to remove.
-
contains
public boolean contains(int key)Search for an item in the hash table.- Parameters:
key
- the item to search for.- Returns:
- true if a matching item found.
-
get
Find an item in the hash table.- Parameters:
key
- the item to search for.- Returns:
- the value of the matching item.
-
makeEmpty
public void makeEmpty()Make the hash table logically empty. -
main
public static void main(java.lang.String[] args)
-