Class Dictionary<K,V>
- Direct Known Subclasses:
Hashtable
Note: Do not use this class since it is obsolete. Please use the
Map interface for new implementations.
Dictionary is an abstract class which is the superclass of all classes that
associate keys with values, such as Hashtable.
Since
1.0
See also
- Hashtable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Enumeration<V> elements()Returns an enumeration on the elements of this dictionary.abstract Vget(java.lang.Object key) Returns the value which is associated withkey.abstract booleanisEmpty()Returns true if this dictionary has no key/value pairs.abstract Enumeration<K> keys()Returns an enumeration on the keys of this dictionary.abstract VAssociatekeywithvaluein this dictionary.abstract Vremove(java.lang.Object key) Removes the key/value pair with the specifiedkeyfrom this dictionary.abstract intsize()Returns the number of key/value pairs in this dictionary.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Dictionary
public Dictionary()Constructs a new instance of this class.
-
-
Method Details
-
elements
Returns an enumeration on the elements of this dictionary.
Returns
an enumeration of the values of this dictionary.
See also
-
#keys
-
#size
-
Enumeration
-
-
get
Returns the value which is associated with
key.Parameters
key: the key of the value returned.
Returns
- Returns:
the value associated with
key, ornullif the specified key does not exist.See also
- #put
-
isEmpty
public abstract boolean isEmpty()Returns true if this dictionary has no key/value pairs.
Returns
- Returns:
trueif this dictionary has no key/value pairs,falseotherwise.See also
- #size
-
keys
Returns an enumeration on the keys of this dictionary.
Returns
an enumeration of the keys of this dictionary.
See also
-
#elements
-
#size
-
Enumeration
-
-
put
Associate
keywithvaluein this dictionary. Ifkeyexists in the dictionary before this call, the old value in the dictionary is replaced byvalue.Parameters
-
key: the key to add. -
value: the value to add.
Returns
the old value previously associated with
keyornullifkeyis new to the dictionary.See also
-
#elements
-
#get
-
#keys
-
-
remove
Removes the key/value pair with the specified
keyfrom this dictionary.Parameters
key: the key to remove.
Returns
- Returns:
the associated value before the deletion or
nullifkeywas not known to this dictionary.See also
-
#get
-
#put
-
-
size
public abstract int size()Returns the number of key/value pairs in this dictionary.
Returns
the number of key/value pairs in this dictionary.
See also
-
#elements
-
#keys
-
-