| java.util.Hashtable
Constructor Summary | |
public | Hashtable(int initialCapacity, float loadFactor) Constructs a new, empty hashtable with the specified initial
capacity and the specified load factor. | public | Hashtable(int initialCapacity) Constructs a new, empty hashtable with the specified initial capacity
and default load factor (0.75). | public | Hashtable() Constructs a new, empty hashtable with a default initial capacity (11)
and load factor (0.75). | public | Hashtable(Map<? extends K, ? extends V> t) Constructs a new hashtable with the same mappings as the given
Map. |
Method Summary | |
public synchronized void | clear() Clears this hashtable so that it contains no keys. | public synchronized Object | clone() Creates a shallow copy of this hashtable. | public synchronized boolean | contains(Object value) Tests if some key maps into the specified value in this hashtable. | public synchronized boolean | containsKey(Object key) Tests if the specified object is a key in this hashtable. | public boolean | containsValue(Object value) Returns true if this hashtable maps one or more keys to this value. | public synchronized Enumeration<V> | elements() Returns an enumeration of the values in this hashtable. | public Set<Map.Entry<K, V>> | entrySet() Returns a
Set view of the mappings contained in this map.
The set is backed by the map, so changes to the map are
reflected in the set, and vice-versa. | public synchronized boolean | equals(Object o) Compares the specified Object with this Map for equality,
as per the definition in the Map interface. | public synchronized V | get(Object key) Returns the value to which the specified key is mapped,
or
null if this map contains no mapping for the key.
More formally, if this map contains a mapping from a key
k to a value
v such that
(key.equals(k)) ,
then this method returns
v ; otherwise it returns
null . | public synchronized int | hashCode() Returns the hash code value for this Map as per the definition in the
Map interface. | public synchronized boolean | isEmpty() Tests if this hashtable maps no keys to values. | public Set<K> | keySet() Returns a
Set view of the keys contained in this map.
The set is backed by the map, so changes to the map are
reflected in the set, and vice-versa. | public synchronized Enumeration<K> | keys() Returns an enumeration of the keys in this hashtable. | public synchronized V | put(K key, V value) Maps the specified key to the specified
value in this hashtable. | public synchronized void | putAll(Map<? extends K, ? extends V> t) Copies all of the mappings from the specified map to this hashtable. | protected void | rehash() Increases the capacity of and internally reorganizes this
hashtable, in order to accommodate and access its entries more
efficiently. | public synchronized V | remove(Object key) Removes the key (and its corresponding value) from this
hashtable. | public synchronized int | size() Returns the number of keys in this hashtable. | public synchronized String | toString() Returns a string representation of this Hashtable object
in the form of a set of entries, enclosed in braces and separated
by the ASCII characters ", " (comma and space). | public Collection<V> | values() Returns a
Collection view of the values contained in this map.
The collection is backed by the map, so changes to the map are
reflected in the collection, and vice-versa. |
Hashtable | public Hashtable(int initialCapacity, float loadFactor)(Code) | | Constructs a new, empty hashtable with the specified initial
capacity and the specified load factor.
Parameters: initialCapacity - the initial capacity of the hashtable. Parameters: loadFactor - the load factor of the hashtable. exception: IllegalArgumentException - if the initial capacity is lessthan zero, or if the load factor is nonpositive. |
Hashtable | public Hashtable(int initialCapacity)(Code) | | Constructs a new, empty hashtable with the specified initial capacity
and default load factor (0.75).
Parameters: initialCapacity - the initial capacity of the hashtable. exception: IllegalArgumentException - if the initial capacity is lessthan zero. |
Hashtable | public Hashtable()(Code) | | Constructs a new, empty hashtable with a default initial capacity (11)
and load factor (0.75).
|
Hashtable | public Hashtable(Map<? extends K, ? extends V> t)(Code) | | Constructs a new hashtable with the same mappings as the given
Map. The hashtable is created with an initial capacity sufficient to
hold the mappings in the given Map and a default load factor (0.75).
Parameters: t - the map whose mappings are to be placed in this map. throws: NullPointerException - if the specified map is null. since: 1.2 |
clear | public synchronized void clear()(Code) | | Clears this hashtable so that it contains no keys.
|
clone | public synchronized Object clone()(Code) | | Creates a shallow copy of this hashtable. All the structure of the
hashtable itself is copied, but the keys and values are not cloned.
This is a relatively expensive operation.
a clone of the hashtable |
contains | public synchronized boolean contains(Object value)(Code) | | Tests if some key maps into the specified value in this hashtable.
This operation is more expensive than the
Hashtable.containsKeycontainsKey method.
Note that this method is identical in functionality to
Hashtable.containsValue containsValue , (which is part of the
Map interface in the collections framework).
Parameters: value - a value to search for true if and only if some key maps to thevalue argument in this hashtable asdetermined by the equals method;false otherwise. exception: NullPointerException - if the value is null |
containsKey | public synchronized boolean containsKey(Object key)(Code) | | Tests if the specified object is a key in this hashtable.
Parameters: key - possible key true if and only if the specified objectis a key in this hashtable, as determined by theequals method; false otherwise. throws: NullPointerException - if the key is null See Also: Hashtable.contains(Object) |
containsValue | public boolean containsValue(Object value)(Code) | | Returns true if this hashtable maps one or more keys to this value.
Note that this method is identical in functionality to
Hashtable.contains contains (which predates the
Map interface).
Parameters: value - value whose presence in this hashtable is to be tested true if this map maps one or more keys to thespecified value throws: NullPointerException - if the value is null since: 1.2 |
entrySet | public Set<Map.Entry<K, V>> entrySet()(Code) | | Returns a
Set view of the mappings contained in this map.
The set is backed by the map, so changes to the map are
reflected in the set, and vice-versa. If the map is modified
while an iteration over the set is in progress (except through
the iterator's own remove operation, or through the
setValue operation on a map entry returned by the
iterator) the results of the iteration are undefined. The set
supports element removal, which removes the corresponding
mapping from the map, via the Iterator.remove,
Set.remove, removeAll, retainAll and
clear operations. It does not support the
add or addAll operations.
since: 1.2 |
equals | public synchronized boolean equals(Object o)(Code) | | Compares the specified Object with this Map for equality,
as per the definition in the Map interface.
Parameters: o - object to be compared for equality with this hashtable true if the specified Object is equal to this Map See Also: Map.equals(Object) since: 1.2 |
get | public synchronized V get(Object key)(Code) | | Returns the value to which the specified key is mapped,
or
null if this map contains no mapping for the key.
More formally, if this map contains a mapping from a key
k to a value
v such that
(key.equals(k)) ,
then this method returns
v ; otherwise it returns
null . (There can be at most one such mapping.)
Parameters: key - the key whose associated value is to be returned the value to which the specified key is mapped, or null if this map contains no mapping for the key throws: NullPointerException - if the specified key is null See Also: Hashtable.put(Object,Object) |
hashCode | public synchronized int hashCode()(Code) | | Returns the hash code value for this Map as per the definition in the
Map interface.
See Also: Map.hashCode since: 1.2 |
isEmpty | public synchronized boolean isEmpty()(Code) | | Tests if this hashtable maps no keys to values.
true if this hashtable maps no keys to values;false otherwise. |
keySet | public Set<K> keySet()(Code) | | Returns a
Set view of the keys contained in this map.
The set is backed by the map, so changes to the map are
reflected in the set, and vice-versa. If the map is modified
while an iteration over the set is in progress (except through
the iterator's own remove operation), the results of
the iteration are undefined. The set supports element removal,
which removes the corresponding mapping from the map, via the
Iterator.remove, Set.remove,
removeAll, retainAll, and clear
operations. It does not support the add or addAll
operations.
since: 1.2 |
put | public synchronized V put(K key, V value)(Code) | | Maps the specified key to the specified
value in this hashtable. Neither the key nor the
value can be null .
The value can be retrieved by calling the get method
with a key that is equal to the original key.
Parameters: key - the hashtable key Parameters: value - the value the previous value of the specified key in this hashtable,or null if it did not have one exception: NullPointerException - if the key or value isnull See Also: Object.equals(Object) See Also: Hashtable.get(Object) |
putAll | public synchronized void putAll(Map<? extends K, ? extends V> t)(Code) | | Copies all of the mappings from the specified map to this hashtable.
These mappings will replace any mappings that this hashtable had for any
of the keys currently in the specified map.
Parameters: t - mappings to be stored in this map throws: NullPointerException - if the specified map is null since: 1.2 |
rehash | protected void rehash()(Code) | | Increases the capacity of and internally reorganizes this
hashtable, in order to accommodate and access its entries more
efficiently. This method is called automatically when the
number of keys in the hashtable exceeds this hashtable's capacity
and load factor.
|
remove | public synchronized V remove(Object key)(Code) | | Removes the key (and its corresponding value) from this
hashtable. This method does nothing if the key is not in the hashtable.
Parameters: key - the key that needs to be removed the value to which the key had been mapped in this hashtable,or null if the key did not have a mapping throws: NullPointerException - if the key is null |
size | public synchronized int size()(Code) | | Returns the number of keys in this hashtable.
the number of keys in this hashtable. |
toString | public synchronized String toString()(Code) | | Returns a string representation of this Hashtable object
in the form of a set of entries, enclosed in braces and separated
by the ASCII characters ", " (comma and space). Each
entry is rendered as the key, an equals sign =, and the
associated element, where the toString method is used to
convert the key and element to strings.
a string representation of this hashtable |
values | public Collection<V> values()(Code) | | Returns a
Collection view of the values contained in this map.
The collection is backed by the map, so changes to the map are
reflected in the collection, and vice-versa. If the map is
modified while an iteration over the collection is in progress
(except through the iterator's own remove operation),
the results of the iteration are undefined. The collection
supports element removal, which removes the corresponding
mapping from the map, via the Iterator.remove,
Collection.remove, removeAll,
retainAll and clear operations. It does not
support the add or addAll operations.
since: 1.2 |
|
|