|
UC Berkeley Group for User Interface Research Updated November 17, 2000 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Dictionary | +--edu.berkeley.guir.lib.awt.image.IntHashtable
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.
Fetch the software.
Fetch the entire Acme package.
Hashtable
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. |
Object |
clone()
Creates a clone of the hashtable. |
boolean |
contains(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. |
Enumeration |
elements()
Returns an enumeration of the elements. |
Object |
get(int key)
Gets the object associated with the specified key in the hashtable. |
Object |
get(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. |
Enumeration |
keys()
Returns an enumeration of the hashtable's keys. |
Object |
put(int key,
Object value)
Puts the specified element into the hashtable, using the specified key. |
Object |
put(Object okey,
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. |
Object |
remove(int key)
Removes the element corresponding to the key. |
Object |
remove(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. |
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.IllegalArgumentException
- If the initial capacity
is less than or equal to zero.IllegalArgumentException
- If the load factor 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 Dictionary
public boolean isEmpty()
isEmpty
in class Dictionary
public Enumeration keys()
keys
in class Dictionary
elements()
public Enumeration elements()
elements
in class Dictionary
keys()
public boolean contains(Object value)
value
- the value that we are looking forNullPointerException
- 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 Object get(int key)
key
- the specified keyput(int, java.lang.Object)
public Object get(Object okey)
get
in class Dictionary
protected void rehash()
public Object put(int key, Object value)
key
- the specified key in the hashtablevalue
- the specified elementNullPointerException
- If the value of the element
is equal to null.get(int)
public Object put(Object okey, Object value)
put
in class Dictionary
public Object remove(int key)
key
- the key that needs to be removedpublic Object remove(Object okey)
remove
in class Dictionary
public void clear()
public Object clone()
clone
in class Object
public String toString()
toString
in class Object
|
Copyright Information | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |