|
Final | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectjava.util.Dictionary
java.util.Hashtable
Hashtable associates keys with values. Keys and values cannot be null. The size of the Hashtable is the number of key/value pairs it contains. The capacity is the number of key/value pairs the Hashtable can hold. The load factor is a float value which determines how full the Hashtable gets before expanding the capacity. If the load factor of the Hashtable is exceeded, the capacity is doubled.
Enumeration,
Serializable,
Object.equals(java.lang.Object),
Object.hashCode(),
Serialized Form| Constructor Summary | |
|---|---|
Hashtable()
Constructs a new Hashtable using the default capacity and load factor. |
|
Hashtable(int capacity)
Constructs a new Hashtable using the specified capacity and the default load factor. |
|
Hashtable(int capacity,
float loadFactor)
Constructs a new Hashtable using the specified capacity and load factor. |
|
Hashtable(Map map)
Constructs a new instance of Hashtable containing the mappings from the specified Map. |
|
| Method Summary | |
|---|---|
void |
clear()
Removes all key/value pairs from this Hashtable, leaving the size zero and the capacity unchanged. |
Object |
clone()
Answers a new Hashtable with the same key/value pairs, capacity and load factor. |
boolean |
contains(Object value)
Answers if this Hashtable contains the specified object as the value of at least one of the key/value pairs. |
boolean |
containsKey(Object key)
Answers if this Hashtable contains the specified object as a key of one of the key/value pairs. |
boolean |
containsValue(Object value)
Searches this Hashtable for the specified value. |
Enumeration |
elements()
Answers an Enumeration on the values of this Hashtable. |
Set |
entrySet()
Answers a Set of the mappings contained in this Hashtable. |
boolean |
equals(Object object)
Compares the specified object to this Hashtable and answer if they are equal. |
Object |
get(Object key)
Answers the value associated with the specified key in this Hashtable. |
int |
hashCode()
Answers an integer hash code for the receiver. |
boolean |
isEmpty()
Answers if this Hashtable has no key/value pairs, a size of zero. |
Enumeration |
keys()
Answers an Enumeration on the keys of this Hashtable. |
Set |
keySet()
Answers a Set of the keys contained in this Hashtable. |
Object |
put(Object key,
Object value)
Associate the specified value with the specified key in this Hashtable. |
void |
putAll(Map map)
Copies every mapping in the specified Map to this Hashtable. |
protected void |
rehash()
Increases the capacity of this Hashtable. |
Object |
remove(Object key)
Remove the key/value pair with the specified key from this Hashtable. |
int |
size()
Answers the number of key/value pairs in this Hashtable. |
String |
toString()
Answers the string representation of this Hashtable. |
Collection |
values()
Answers a Collection of the values contained in this Hashtable. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Hashtable()
public Hashtable(int capacity)
capacity - the initial capacitypublic Hashtable(int capacity,
float loadFactor)
capacity - the initial capacityloadFactor - the initial load factorpublic Hashtable(Map map)
map - the mappings to add| Method Detail |
public void clear()
clear in interface MapisEmpty(),
size()public Object clone()
clone in class ObjectCloneablepublic boolean contains(Object value)
value - the object to look for as a value in this Hashtable
containsKey(java.lang.Object),
Object.equals(java.lang.Object)public boolean containsKey(Object key)
containsKey in interface Mapkey - the object to look for as a key in this Hashtable
contains(java.lang.Object),
Object.equals(java.lang.Object)public boolean containsValue(Object value)
containsValue in interface Mapvalue - the object to search for
value is a value of this Hashtable, false otherwisepublic Enumeration elements()
elements in class Dictionarykeys(),
size(),
Enumerationpublic Set entrySet()
entrySet in interface Mappublic boolean equals(Object object)
equals in interface Mapequals in class Objectobject - the object to compare with this object
hashCode()public Object get(Object key)
get in interface Mapget in class Dictionarykey - the key of the value returned
put(java.lang.Object, java.lang.Object)public int hashCode()
hashCode in interface MaphashCode in class Objectequals(java.lang.Object)public boolean isEmpty()
isEmpty in interface MapisEmpty in class Dictionarysize()public Enumeration keys()
keys in class Dictionaryelements(),
size(),
Enumerationpublic Set keySet()
keySet in interface Mappublic Object put(Object key,
Object value)
put in interface Mapput in class Dictionarykey - the key to addvalue - the value to add
elements(),
get(java.lang.Object),
keys(),
Object.equals(java.lang.Object)public void putAll(Map map)
putAll in interface Mapmap - the Map to copy mappings fromprotected void rehash()
public Object remove(Object key)
remove in interface Mapremove in class Dictionarykey - the key to remove
get(java.lang.Object),
put(java.lang.Object, java.lang.Object)public int size()
size in interface Mapsize in class Dictionaryelements(),
keys()public String toString()
toString in class Objectpublic Collection values()
values in interface Map
|
Final | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||