DthingApi
Classes | Public Member Functions | Protected Member Functions | List of all members
java.util.Hashtable< K, V > Class Template Reference
Inheritance diagram for java.util.Hashtable< K, V >:
java.util.Dictionary< K, V > java.util.Map< K, V > java.io.Serializable

Public Member Functions

 Hashtable ()
 
 Hashtable (int capacity)
 
 Hashtable (int capacity, float loadFactor)
 
 Hashtable (Map<? extends K, ? extends V > map)
 
synchronized Object clone ()
 
synchronized boolean isEmpty ()
 
synchronized int size ()
 
synchronized V get (Object key)
 
synchronized boolean containsKey (Object key)
 
synchronized boolean containsValue (Object value)
 
boolean contains (Object value)
 
synchronized V put (K key, V value)
 
synchronized void putAll (Map<? extends K, ? extends V > map)
 
synchronized V remove (Object key)
 
synchronized void clear ()
 
synchronized Set< K > keySet ()
 
synchronized Collection< V > values ()
 
synchronized Set< Entry< K, V > > entrySet ()
 
synchronized Enumeration< K > keys ()
 
synchronized Enumeration< V > elements ()
 
synchronized boolean equals (Object object)
 
synchronized int hashCode ()
 
synchronized String toString ()
 
- Public Member Functions inherited from java.util.Dictionary< K, V >
 Dictionary ()
 
abstract Enumeration< V > elements ()
 
abstract V get (Object key)
 
abstract boolean isEmpty ()
 
abstract Enumeration< K > keys ()
 
abstract V put (K key, V value)
 
abstract V remove (Object key)
 
abstract int size ()
 
- Public Member Functions inherited from java.util.Map< K, V >
void putAll (Map<? extends K,? extends V > map)
 

Protected Member Functions

void rehash ()
 

Detailed Description

Hashtable is a synchronized implementation of Map. All optional operations are supported.

Neither keys nor values can be null. (Use

HashMap

or

LinkedHashMap

if you need null keys or values.)

Parameters
<K>the type of keys maintained by this map
<V>the type of mapped values
See also
HashMap

Constructor & Destructor Documentation

◆ Hashtable() [1/4]

java.util.Hashtable< K, V >.Hashtable ( )
inline

Constructs a new

using the default capacity and load factor.

◆ Hashtable() [2/4]

java.util.Hashtable< K, V >.Hashtable ( int  capacity)
inline

Constructs a new

using the specified capacity and the default load factor.

Parameters
capacitythe initial capacity.

◆ Hashtable() [3/4]

java.util.Hashtable< K, V >.Hashtable ( int  capacity,
float  loadFactor 
)
inline

Constructs a new

using the specified capacity and load factor.

Parameters
capacitythe initial capacity.
loadFactorthe initial load factor.

◆ Hashtable() [4/4]

java.util.Hashtable< K, V >.Hashtable ( Map<? extends K, ? extends V >  map)
inline

Constructs a new instance of

containing the mappings from the specified map.

Parameters
mapthe mappings to add.

Member Function Documentation

◆ clear()

synchronized void java.util.Hashtable< K, V >.clear ( )
inline

Removes all key/value pairs from this

, leaving the size zero and the capacity unchanged.

See also
isEmpty
#size

Implements java.util.Map< K, V >.

◆ clone()

synchronized Object java.util.Hashtable< K, V >.clone ( )
inline

Returns a new

with the same key/value pairs, capacity and load factor.

Returns
a shallow copy of this .
See also
java.lang.Cloneable

◆ contains()

boolean java.util.Hashtable< K, V >.contains ( Object  value)
inline

Returns true if this

contains the specified object as the value of at least one of the key/value pairs.

Parameters
valuethe object to look for as a value in this .
Returns
true
if object is a value in this ,
false
otherwise.
See also
containsKey
java.lang.Object::equals

◆ containsKey()

synchronized boolean java.util.Hashtable< K, V >.containsKey ( Object  key)
inline

Returns true if this

contains the specified object as a key of one of the key/value pairs.

Parameters
keythe object to look for as a key in this .
Returns
true
if object is a key in this ,
false
otherwise.
See also
contains
java.lang.Object::equals

Implements java.util.Map< K, V >.

◆ containsValue()

synchronized boolean java.util.Hashtable< K, V >.containsValue ( Object  value)
inline

Searches this

for the specified value.

Parameters
valuethe object to search for.
Returns
true
if
value
is a value of this ,
false
otherwise.

Implements java.util.Map< K, V >.

◆ elements()

synchronized Enumeration<V> java.util.Hashtable< K, V >.elements ( )
inline

Returns an enumeration on the values of this

. The results of the Enumeration may be affected if the contents of this

are modified.

Returns
an enumeration of the values of this .
See also
keys
#size
Enumeration

◆ entrySet()

synchronized Set<Entry<K, V> > java.util.Hashtable< K, V >.entrySet ( )
inline

Returns a set of the mappings contained in this

. Each element in the set is a Map.Entry. The set is backed by this

so changes to one are reflected by the other. The set does not support adding.

Returns
a set of the mappings.

Implements java.util.Map< K, V >.

◆ equals()

synchronized boolean java.util.Hashtable< K, V >.equals ( Object  object)
inline

Compares this

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.

Parameters
objectthe object to compare with this object.
Returns
true
if the specified object is equal to this Map,
false
otherwise.
See also
hashCode

Implements java.util.Map< K, V >.

◆ get()

synchronized V java.util.Hashtable< K, V >.get ( Object  key)
inline

Returns the value associated with the specified key in this

.

Parameters
keythe key of the value returned.
Returns
the value associated with the specified key, or
null
if the specified key does not exist.
See also
put

Implements java.util.Map< K, V >.

◆ hashCode()

synchronized int java.util.Hashtable< K, V >.hashCode ( )
inline

Returns an integer hash code for the receiver.

Object

s which are equal return the same value for this method.

Returns
the receiver's hash.
See also
equals(Object)

Implements java.util.Map< K, V >.

◆ isEmpty()

synchronized boolean java.util.Hashtable< K, V >.isEmpty ( )
inline

Returns true if this

has no key/value pairs.

Returns
true
if this has no key/value pairs,
false
otherwise.
See also
#size

Implements java.util.Map< K, V >.

◆ keys()

synchronized Enumeration<K> java.util.Hashtable< K, V >.keys ( )
inline

Returns an enumeration on the keys of this

instance. The results of the enumeration may be affected if the contents of this

are modified.

Returns
an enumeration of the keys of this .
See also
elements
#size
Enumeration

◆ keySet()

synchronized Set<K> java.util.Hashtable< K, V >.keySet ( )
inline

Returns a set of the keys contained in this

. The set is backed by this

so changes to one are reflected by the other. The set does not support adding.

Returns
a set of the keys.

Implements java.util.Map< K, V >.

◆ put()

synchronized V java.util.Hashtable< K, V >.put ( key,
value 
)
inline

Associate the specified value with the specified key in this

. If the key already exists, the old value is replaced. The key and value cannot be null.

Parameters
keythe key to add.
valuethe value to add.
Returns
the old value associated with the specified key, or
null
if the key did not exist.
See also
elements
get
keys
java.lang.Object::equals

Implements java.util.Map< K, V >.

◆ putAll()

synchronized void java.util.Hashtable< K, V >.putAll ( Map<? extends K, ? extends V >  map)
inline

Copies every mapping to this

from the specified map.

Parameters
mapthe map to copy mappings from.

◆ rehash()

void java.util.Hashtable< K, V >.rehash ( )
inlineprotected

Increases the capacity of this

. This method is called when the size of this

exceeds the load factor.

◆ remove()

synchronized V java.util.Hashtable< K, V >.remove ( Object  key)
inline

Removes the key/value pair with the specified key from this

.

Parameters
keythe key to remove.
Returns
the value associated with the specified key, or
null
if the specified key did not exist.
See also
get
put

Implements java.util.Map< K, V >.

◆ size()

synchronized int java.util.Hashtable< K, V >.size ( )
inline

Returns the number of key/value pairs in this

.

Returns
the number of key/value pairs in this .
See also
elements
keys

Implements java.util.Map< K, V >.

◆ toString()

synchronized String java.util.Hashtable< K, V >.toString ( )
inline

Returns the string representation of this

.

Returns
the string representation of this .

◆ values()

synchronized Collection<V> java.util.Hashtable< K, V >.values ( )
inline

Returns a collection of the values contained in this

. The collection is backed by this

so changes to one are reflected by the other. The collection does not support adding.

Returns
a collection of the values.

Implements java.util.Map< K, V >.


The documentation for this class was generated from the following file: