![]() |
|
Contents |
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.
java.lang.Object.equals
java.lang.Object.hashCode
Public Member Functions | |
| 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<?extends K,?extends V > map) | |
| Constructs a new instance of Hashtable containing the mappings from the specified Map. | |
| synchronized void | clear () |
| Removes all key/value pairs from this Hashtable, leaving the size zero and the capacity unchanged. | |
| synchronized Object | clone () |
| Answers a new Hashtable with the same key/value pairs, capacity and load factor. | |
| synchronized boolean | contains (Object value) |
| Answers if this Hashtable contains the specified object as the value of at least one of the key/value pairs. | |
| synchronized 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. | |
| synchronized Enumeration< V > | elements () |
| Answers an Enumeration on the values of this Hashtable. | |
| Set< Map.Entry< K, V > > | entrySet () |
| Answers a Set of the mappings contained in this Hashtable. | |
| synchronized boolean | equals (Object object) |
| Compares the specified object to this Hashtable and answer if they are equal. | |
| synchronized V | get (Object key) |
| Answers the value associated with the specified key in this Hashtable. | |
| synchronized int | hashCode () |
| Answers an integer hash code for the receiver. | |
| synchronized boolean | isEmpty () |
| Answers if this Hashtable has no key/value pairs, a size of zero. | |
| synchronized Enumeration< K > | keys () |
| Answers an Enumeration on the keys of this Hashtable. | |
| Set< K > | keySet () |
| Answers a Set of the keys contained in this Hashtable. | |
| synchronized V | put (K key, V value) |
| Associate the specified value with the specified key in this Hashtable. | |
| synchronized void | putAll (Map<?extends K,?extends V > map) |
| Copies every mapping in the specified Map to this Hashtable. | |
| synchronized V | remove (Object key) |
| Remove the key/value pair with the specified key from this Hashtable. | |
| synchronized int | size () |
| Answers the number of key/value pairs in this Hashtable. | |
| synchronized String | toString () |
| Answers the string representation of this Hashtable. | |
| Collection< V > | values () |
| Answers a Collection of the values contained in this Hashtable. | |
Protected Member Functions | |
| void | rehash () |
| Increases the capacity of this Hashtable. | |
Package Functions | |
| Entry< K, V > | getEntry (Object key) |
Package Attributes | |
| transient int | elementCount |
| transient Entry< K, V >[] | elementData |
| transient int | firstSlot |
| transient int | lastSlot = -1 |
| transient int | modCount |
Private Member Functions | |
| Entry< K, V >[] | newElementArray (int size) |
| void | computeMaxSize () |
| synchronized void | writeObject (ObjectOutputStream stream) throws IOException |
| void | readObject (ObjectInputStream stream) throws IOException, ClassNotFoundException |
Static Private Member Functions | |
| static< K, V > Entry< K, V > | newEntry (K key, V value, int hash) |
Private Attributes | |
| float | loadFactor |
| int | threshold |
Static Private Attributes | |
| static final long | serialVersionUID = 1421746759512286392L |
| static final Enumeration<?> | EMPTY_ENUMERATION |
Classes | |
| class | Entry< K, V > |
| class | HashEnumerator< E > |
| class | HashIterator< E > |
| 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.
| capacity | the initial capacity |
| Hashtable | ( | int | capacity, | |
| float | loadFactor | |||
| ) |
Constructs a new Hashtable using the specified capacity and load factor.
| capacity | the initial capacity | |
| loadFactor | the initial load factor |
| Hashtable | ( | Map<?extends K,?extends V > | map | ) |
Constructs a new instance of Hashtable containing the mappings from the specified Map.
| map | the mappings to add |
| static <K,V> Entry<K, V> newEntry | ( | K | key, | |
| V | value, | |||
| int | hash | |||
| ) | [static, private] |
| Entry<K, V> [] newElementArray | ( | int | size | ) | [private] |
| synchronized void clear | ( | ) |
Removes all key/value pairs from this Hashtable, leaving the size zero and the capacity unchanged.
Implements Map< K, V >.
| synchronized Object clone | ( | ) |
Answers a new Hashtable with the same key/value pairs, capacity and load factor.
| void computeMaxSize | ( | ) | [private] |
| synchronized boolean contains | ( | Object | value | ) |
Answers if this Hashtable contains the specified object as the value of at least one of the key/value pairs.
| value | the object to look for as a value in this Hashtable |
java.lang.Object.equals
| synchronized boolean containsKey | ( | Object | key | ) |
Answers if this Hashtable contains the specified object as a key of one of the key/value pairs.
| key | the object to look for as a key in this Hashtable |
java.lang.Object.equals
Implements Map< K, V >.
| boolean containsValue | ( | Object | value | ) |
Searches this Hashtable for the specified value.
| value | the object to search for |
value is a value of this Hashtable, false otherwise Implements Map< K, V >.
| synchronized Enumeration<V> elements | ( | ) | [virtual] |
Answers an Enumeration on the values of this Hashtable.
The results of the Enumeration may be affected if the contents of this Hashtable are modified.
Implements Dictionary< K, V >.
| Set<Map.Entry<K, V> > entrySet | ( | ) |
Answers a Set of the mappings contained in this Hashtable.
Each element in the set is a Map.Entry. The set is backed by this Hashtable so changes to one are reflected by the other. The set does not support adding.
Implements Map< K, V >.
| synchronized boolean equals | ( | Object | object | ) |
Compares the specified object to this Hashtable and answer if they are equal.
The object must be an instance of Map and contain the same key/value pairs.
| object | the object to compare with this object |
Implements Map< K, V >.
| synchronized V get | ( | Object | key | ) | [virtual] |
Answers the value associated with the specified key in this Hashtable.
| key | the key of the value returned |
Implements Dictionary< K, V >.
| Entry<K, V> getEntry | ( | Object | key | ) | [package] |
| synchronized int hashCode | ( | ) |
Answers an integer hash code for the receiver.
Objects which are equal answer the same value for this method.
Implements Map< K, V >.
| synchronized boolean isEmpty | ( | ) | [virtual] |
Answers if this Hashtable has no key/value pairs, a size of zero.
Implements Dictionary< K, V >.
| synchronized Enumeration<K> keys | ( | ) | [virtual] |
Answers an Enumeration on the keys of this Hashtable.
The results of the Enumeration may be affected if the contents of this Hashtable are modified.
Implements Dictionary< K, V >.
| Set<K> keySet | ( | ) |
Answers a Set of the keys contained in this Hashtable.
The set is backed by this Hashtable so changes to one are reflected by the other. The set does not support adding.
Implements Map< K, V >.
| synchronized V put | ( | K | key, | |
| V | value | |||
| ) | [virtual] |
Associate the specified value with the specified key in this Hashtable.
If the key already exists, the old value is replaced. The key and value cannot be null.
| key | the key to add | |
| value | the value to add |
Implements Dictionary< K, V >.
| synchronized void putAll | ( | Map<?extends K,?extends V > | map | ) |
Copies every mapping in the specified Map to this Hashtable.
| map | the Map to copy mappings from |
Implements Map< K, V >.
| void rehash | ( | ) | [protected] |
Increases the capacity of this Hashtable.
This method is sent when the size of this Hashtable exceeds the load factor.
| synchronized V remove | ( | Object | key | ) | [virtual] |
Remove the key/value pair with the specified key from this Hashtable.
| key | the key to remove |
Implements Dictionary< K, V >.
| synchronized int size | ( | ) | [virtual] |
Answers the number of key/value pairs in this Hashtable.
Implements Dictionary< K, V >.
| synchronized String toString | ( | ) |
Answers the string representation of this Hashtable.
| Collection<V> values | ( | ) |
Answers a Collection of the values contained in this Hashtable.
The collection is backed by this Hashtable so changes to one are reflected by the other. The collection does not support adding.
Implements Map< K, V >.
| synchronized void writeObject | ( | ObjectOutputStream | stream | ) | throws IOException [private] |
| void readObject | ( | ObjectInputStream | stream | ) | throws IOException, ClassNotFoundException [private] |
final long serialVersionUID = 1421746759512286392L [static, private] |
transient int elementCount [package] |
transient Entry<K, V> [] elementData [package] |
float loadFactor [private] |
int threshold [private] |
transient int firstSlot [package] |
transient int lastSlot = -1 [package] |
transient int modCount [package] |
final Enumeration<?> EMPTY_ENUMERATION [static, private] |
Initial value:
new Enumeration<Object>() { public boolean hasMoreElements() { return false; } public Object nextElement() { throw new NoSuchElementException(); } }