|
MVT API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--java.util.Dictionary
|
+--mvt.util.IntHashtable
IntHashtable - a Hashtable that uses ints as the keys This is 90% based on Java's java.util.Hashtable. Visit the ACME Labs Java page for up-to-date versions of this and other fine Java utilities: http://www.acme.com/java/ A Hashtable that uses ints as the keys. Use just like java.util.Hashtable, except that the keys must be ints. This is much faster than creating a new Integer for each access.
| Constructor Summary | |
IntHashtable()
Constructs a new, empty hashtable. |
|
IntHashtable(int initialCapacity)
Constructs a new, empty hashtable with the specified initial capacity. |
|
IntHashtable(int initialCapacity,
float loadFactor)
Constructs a new, empty hashtable with the specified initial capacity and the specified load factor. |
|
| Method Summary | |
void |
clear()
Clears the hash table so that it has no more elements in it. |
java.lang.Object |
clone()
Creates a clone of the hashtable. |
void |
combine(IntHashtable newhash)
Puts the data from the newhash argument
IntHashtable into this IntHashtable; thus combining the
two IntHashtables. |
boolean |
contains(java.lang.Object value)
Returns true if the specified object is an element of the hashtable. |
boolean |
containsKey(int key)
Returns true if the collection contains an element for the key. |
java.util.Enumeration |
elements()
Returns an enumeration of the elements. |
java.lang.Object |
get(int key)
Gets the object associated with the specified key in the hashtable. |
java.lang.Object |
get(java.lang.Object okey)
A get method that takes an Object, for compatibility with java.util.Dictionary. |
boolean |
isEmpty()
Returns true if the hashtable contains no elements. |
java.util.Enumeration |
keys()
Returns an enumeration of the hashtable's keys. |
java.lang.Object |
put(int key,
java.lang.Object value)
Puts the specified element into the hashtable, using the specified key. |
java.lang.Object |
put(java.lang.Object okey,
java.lang.Object value)
A put method that takes an Object, for compatibility with java.util.Dictionary. |
protected void |
rehash()
Rehashes the content of the table into a bigger table. |
java.lang.Object |
remove(int key)
Removes the element corresponding to the key. |
java.lang.Object |
remove(java.lang.Object okey)
A remove method that takes an Object, for compatibility with java.util.Dictionary. |
int |
size()
Returns the number of elements contained in the hashtable. |
java.lang.String |
toString()
Converts to a rather lengthy String. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public IntHashtable(int initialCapacity,
float loadFactor)
initialCapacity - the initial number of bucketsloadFactor - a number between 0.0 and 1.0, it defines
the threshold for rehashing the hashtable into
a bigger one.
java.lang.IllegalArgumentException - If the initial capacity
is less than or equal to zero.public IntHashtable(int initialCapacity)
initialCapacity - the initial number of bucketspublic IntHashtable()
| Method Detail |
public int size()
size in class java.util.Dictionarypublic boolean isEmpty()
isEmpty in class java.util.Dictionarypublic java.util.Enumeration keys()
keys in class java.util.Dictionaryelements()public java.util.Enumeration elements()
elements in class java.util.Dictionarykeys()public boolean contains(java.lang.Object value)
value - the value that we are looking for
java.lang.NullPointerException - If the value being searched
for is equal to null.containsKey(int)public boolean containsKey(int key)
key - the key that we are looking forcontains(java.lang.Object)public java.lang.Object get(int key)
key - the specified keyput(int, java.lang.Object)public java.lang.Object get(java.lang.Object okey)
get in class java.util.Dictionaryprotected void rehash()
public java.lang.Object put(int key,
java.lang.Object value)
key - the specified key in the hashtablevalue - the specified element
java.lang.NullPointerException - If the value of the element
is equal to null.get(int)
public java.lang.Object put(java.lang.Object okey,
java.lang.Object value)
put in class java.util.Dictionarypublic java.lang.Object remove(int key)
key - the key that needs to be removed
public java.lang.Object remove(java.lang.Object okey)
remove in class java.util.Dictionarypublic void clear()
public java.lang.Object clone()
clone in class java.lang.Objectpublic void combine(IntHashtable newhash)
newhash argument
IntHashtable into this IntHashtable; thus combining the
two IntHashtables.
public java.lang.String toString()
toString in class java.lang.Object
|
MVT API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||