Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

oracle.adfnmc.java.util
Class Hashtable

java.lang.Object
  extended by oracle.adfnmc.java.util.Dictionary
      extended by oracle.adfnmc.java.util.Hashtable
All Implemented Interfaces:
Serializable, Cloneable, Map

public class Hashtable
extends Dictionary
implements Map, Cloneable, Serializable

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.

See Also:
Enumeration, Serializable, Object.equals(java.lang.Object), Object.hashCode()

Constructor Summary
Hashtable()
          Constructs a new Hashtable using the default capacity and load factor.
Hashtable(java.util.Hashtable map)
           
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.
 java.lang.Object clone()
          Answers a new Hashtable with the same key/value pairs, capacity and load factor.
 boolean contains(java.lang.Object value)
          Answers if this Hashtable contains the specified object as the value of at least one of the key/value pairs.
 boolean containsKey(java.lang.Object key)
          Answers if this Hashtable contains the specified object as a key of one of the key/value pairs.
 boolean containsValue(java.lang.Object value)
          Searches this Hashtable for the specified value.
 java.util.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(java.lang.Object object)
          Compares the specified object to this Hashtable and answer if they are equal.
 java.lang.Object get(java.lang.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.
 java.util.Enumeration keys()
          Answers an Enumeration on the keys of this Hashtable.
 Set keySet()
          Answers a Set of the keys contained in this Hashtable.
 java.lang.Object put(java.lang.Object key, java.lang.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.
 java.lang.Object remove(java.lang.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.
 java.lang.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
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Hashtable

public Hashtable()
Constructs a new Hashtable using the default capacity and load factor.


Hashtable

public Hashtable(int capacity)
Constructs a new Hashtable using the specified capacity and the default load factor.

Parameters:
capacity - the initial capacity

Hashtable

public Hashtable(int capacity,
                 float loadFactor)
Constructs a new Hashtable using the specified capacity and load factor.

Parameters:
capacity - the initial capacity
loadFactor - the initial load factor

Hashtable

public Hashtable(Map map)
Constructs a new instance of Hashtable containing the mappings from the specified Map.

Parameters:
map - the mappings to add

Hashtable

public Hashtable(java.util.Hashtable map)
Method Detail

clear

public void clear()
Removes all key/value pairs from this Hashtable, leaving the size zero and the capacity unchanged.

Specified by:
clear in interface Map
See Also:
isEmpty(), size()

clone

public java.lang.Object clone()
Answers a new Hashtable with the same key/value pairs, capacity and load factor.

Returns:
a shallow copy of this Hashtable
See Also:
Cloneable

contains

public boolean contains(java.lang.Object value)
Answers if this Hashtable contains the specified object as the value of at least one of the key/value pairs.

Parameters:
value - the object to look for as a value in this Hashtable
Returns:
true if object is a value in this Hashtable, false otherwise
See Also:
containsKey(java.lang.Object), Object.equals(java.lang.Object)

containsKey

public boolean containsKey(java.lang.Object key)
Answers if this Hashtable contains the specified object as a key of one of the key/value pairs.

Specified by:
containsKey in interface Map
Parameters:
key - the object to look for as a key in this Hashtable
Returns:
true if object is a key in this Hashtable, false otherwise
See Also:
contains(java.lang.Object), Object.equals(java.lang.Object)

containsValue

public boolean containsValue(java.lang.Object value)
Searches this Hashtable for the specified value.

Specified by:
containsValue in interface Map
Parameters:
value - the object to search for
Returns:
true if value is a value of this Hashtable, false otherwise

elements

public java.util.Enumeration elements()
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.

Specified by:
elements in class Dictionary
Returns:
an Enumeration of the values of this Hashtable
See Also:
keys(), size(), Enumeration

entrySet

public Set 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.

Specified by:
entrySet in interface Map
Returns:
a Set of the mappings

equals

public boolean equals(java.lang.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.

Specified by:
equals in interface Map
Overrides:
equals in class java.lang.Object
Parameters:
object - the object to compare with this object
Returns:
true if the specified object is equal to this Map, false otherwise
See Also:
hashCode()

get

public java.lang.Object get(java.lang.Object key)
Answers the value associated with the specified key in this Hashtable.

Specified by:
get in interface Map
Specified by:
get in class Dictionary
Parameters:
key - the key of the value returned
Returns:
the value associated with the specified key, null if the specified key does not exist
See Also:
put(java.lang.Object, java.lang.Object)

hashCode

public int hashCode()
Answers an integer hash code for the receiver. Objects which are equal answer the same value for this method.

Specified by:
hashCode in interface Map
Overrides:
hashCode in class java.lang.Object
Returns:
the receiver's hash
See Also:
equals(java.lang.Object)

isEmpty

public boolean isEmpty()
Answers if this Hashtable has no key/value pairs, a size of zero.

Specified by:
isEmpty in interface Map
Specified by:
isEmpty in class Dictionary
Returns:
true if this Hashtable has no key/value pairs, false otherwise
See Also:
size()

keys

public java.util.Enumeration keys()
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.

Specified by:
keys in class Dictionary
Returns:
an Enumeration of the keys of this Hashtable
See Also:
elements(), size(), Enumeration

keySet

public Set 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.

Specified by:
keySet in interface Map
Returns:
a Set of the keys

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
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.

Specified by:
put in interface Map
Specified by:
put in class Dictionary
Parameters:
key - the key to add
value - the value to add
Returns:
the old value associated with the specified key, null if the key did not exist
See Also:
elements(), get(java.lang.Object), keys(), Object.equals(java.lang.Object)

putAll

public void putAll(Map map)
Copies every mapping in the specified Map to this Hashtable.

Specified by:
putAll in interface Map
Parameters:
map - the Map to copy mappings from

rehash

protected void rehash()
Increases the capacity of this Hashtable. This method is sent when the size of this Hashtable exceeds the load factor.


remove

public java.lang.Object remove(java.lang.Object key)
Remove the key/value pair with the specified key from this Hashtable.

Specified by:
remove in interface Map
Specified by:
remove in class Dictionary
Parameters:
key - the key to remove
Returns:
the value associated with the specified key, null if the specified key did not exist
See Also:
get(java.lang.Object), put(java.lang.Object, java.lang.Object)

size

public int size()
Answers the number of key/value pairs in this Hashtable.

Specified by:
size in interface Map
Specified by:
size in class Dictionary
Returns:
the number of key/value pairs in this Hashtable
See Also:
elements(), keys()

toString

public java.lang.String toString()
Answers the string representation of this Hashtable.

Overrides:
toString in class java.lang.Object
Returns:
the string representation of this Hashtable

values

public Collection 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.

Specified by:
values in interface Map
Returns:
a Collection of the values

Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.