21.15.5. Hashtable
The Hashtable<K,V> class is similar to the HashMap class, but implements the methods of
Dictionary as well as (more recently) implementing the Map interface. All methods of Hashtable are
synchronized, unlike HashMap. Beyond the methods inherited from Dictionary and Map, Hashtable
adds the following methods and constructors:
publicHashtable()
Analogous to HashMap().
publicHashtable(int initialCapacity)
Analogous to HashMap(initalCapacity).
publicHashtable(int initialCapacity, float loadFactor)
Analogous to HashMap(initialCapacity,loadFactor).
publicHashtable(Map<? extends K,? extends V> t)
Analogous to HashMap(map).
public booleancontains(Object elem)
Analogous to containsValue(elem).
21.16. Properties
A Properties object is used to store string keys and associated string elements. This kind of hashtable
often has a default Properties object in which to look for properties that are not specified in the table
itself. The Properties class extends Hashtable<Object,Object>. Standard Hashtable methods
are used for almost all manipulation of a Properties object, but to get and set properties, you can use
string-based methods. In addition to inherited methods, the following methods and constructors are provided:
publicProperties()
Creates an empty property map.
publicProperties(Properties defaults)
Creates an empty property map with the specified default Properties
object. If a property lookup fails, the default Properties object is queried.
The default Properties object can have its own default Properties
object, and so on. The chain of default objects can be arbitrarily deep.
public StringgetProperty(String key)
Gets the property element for key. If the key is not found in this object, the
default Properties object (if any) is searched. Returns null if the
property is not found.