java.lang.Object | ||
↳ | java.util.Dictionary<K, V> | |
↳ | java.util.Hashtable<K, V> |
Known Direct Subclasses |
Known Indirect Subclasses |
Hashtable associates keys with values. Both 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.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new
Hashtable using the default capacity and load
factor. | |||||||||||
Constructs a new
Hashtable using the specified capacity and the
default load factor. | |||||||||||
Constructs a new
Hashtable using the specified capacity and load
factor. | |||||||||||
Constructs a new instance of
Hashtable containing the mappings
from the specified map. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Removes all key/value pairs from this
Hashtable , leaving the
size zero and the capacity unchanged. | |||||||||||
Returns a new
Hashtable with the same key/value pairs, capacity
and load factor. | |||||||||||
Returns true if this
Hashtable contains the specified object as
the value of at least one of the key/value pairs. | |||||||||||
Returns true if this
Hashtable contains the specified object as a
key of one of the key/value pairs. | |||||||||||
Searches this
Hashtable for the specified value. | |||||||||||
Returns an enumeration on the values of this
Hashtable . | |||||||||||
Returns a set of the mappings contained in this
Hashtable . | |||||||||||
Compares this
Hashtable with the specified object and indicates
if they are equal. | |||||||||||
Returns the value associated with the specified key in this
Hashtable . | |||||||||||
Returns an integer hash code for this object.
| |||||||||||
Returns true if this
Hashtable has no key/value pairs. | |||||||||||
Returns a set of the keys contained in this
Hashtable . | |||||||||||
Returns an enumeration on the keys of this
Hashtable instance. | |||||||||||
Associate the specified value with the specified key in this
Hashtable . | |||||||||||
Copies every mapping to this
Hashtable from the specified map. | |||||||||||
Removes the key/value pair with the specified key from this
Hashtable . | |||||||||||
Returns the number of key/value pairs in this
Hashtable . | |||||||||||
Returns the string representation of this
Hashtable . | |||||||||||
Returns a collection of the values contained in this
Hashtable . |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Increases the capacity of this
Hashtable . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.util.Dictionary
| |||||||||||
From class java.lang.Object
| |||||||||||
From interface java.util.Map
|
Constructs a new Hashtable
using the default capacity and load
factor.
Constructs a new Hashtable
using the specified capacity and the
default load factor.
capacity | the initial capacity. |
---|
Constructs a new Hashtable
using the specified capacity and load
factor.
capacity | the initial capacity. |
---|---|
loadFactor | the initial load factor. |
Constructs a new instance of Hashtable
containing the mappings
from the specified map.
map | the mappings to add. |
---|
Returns a new Hashtable
with the same key/value pairs, capacity
and load factor.
Hashtable
.Returns true 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 . |
---|
true
if object is a value in this Hashtable
,
false
otherwise.Returns true 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 . |
---|
true
if object is a key in this Hashtable
,
false
otherwise.Searches this Hashtable
for the specified value.
value | the object to search for. |
---|
true
if value
is a value of this
Hashtable
, false
otherwise.Returns an enumeration on the values of this Hashtable
. The
results of the Enumeration may be affected if the contents of this
Hashtable
are modified.
Hashtable
.Returns 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.
Compares this Hashtable
with the specified object and indicates
if they are equal. In order to be equal, object
must be an
instance of Map and contain the same key/value pairs.
object | the object to compare with this object. |
---|
true
if the specified object is equal to this Map,
false
otherwise.Returns the value associated with the specified key in this
Hashtable
.
key | the key of the value returned. |
---|
null
if
the specified key does not exist.Returns an integer hash code for this object. By contract, any two
objects for which equals(Object)
returns true
must return
the same hash code value. This means that subclasses of Object
usually override both methods or neither method.
Returns true if this Hashtable
has no key/value pairs.
true
if this Hashtable
has no key/value pairs,
false
otherwise.Returns 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.
Returns an enumeration on the keys of this Hashtable
instance.
The results of the enumeration may be affected if the contents of this
Hashtable
are modified.
Hashtable
.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. |
null
if the key did not exist.Copies every mapping to this Hashtable
from the specified map.
map | the map to copy mappings from. |
---|
Removes the key/value pair with the specified key from this
Hashtable
.
key | the key to remove. |
---|
null
if
the specified key did not exist.Returns the number of key/value pairs in this Hashtable
.
Hashtable
.Returns the string representation of this Hashtable
.
Hashtable
.Returns 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.
Increases the capacity of this Hashtable
. This method is called
when the size of this Hashtable
exceeds the load factor.