public abstract class Dictionary<K, V>
- Object
- Dictionary
Known subtypesHashtable
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.
See also
Constructors
public Dictionary() | Constructs a new instance of this class. |
Methods
public abstract Enumeration<V> elements() | Returns an enumeration on the elements of this dictionary. |
public abstract V get(Object key) | Returns the value which is associated with key. |
public abstract boolean isEmpty() | Returns true if this dictionary has no key/value pairs. |
public abstract Enumeration<K> keys() | Returns an enumeration on the keys of this dictionary. |
public abstract V put(K key, V value) | Associate key with value in this dictionary. |
public abstract V remove(Object key) | Removes the key/value pair with the specified key from this dictionary. |
public abstract int size() | Returns the number of key/value pairs in this dictionary. |
Inherited methods
Constructor details
Dictionary
public Dictionary()Constructs a new instance of this class.
Method details
elements
public abstract Enumeration<V> elements()Returns an enumeration on the elements of this dictionary.
Returns
an enumeration of the values of this dictionary.
See also
get
public abstract V get(Object key)Returns the value which is associated with
key.Parameters
keyObject- the key of the value returned.
Returns
the value associated with
key, or null if the
specified key does not exist.See also
isEmpty
public abstract boolean isEmpty()Returns true if this dictionary has no key/value pairs.
Returns
true if this dictionary has no key/value pairs,
false otherwise.See also
keys
public abstract Enumeration<K> keys()Returns an enumeration on the keys of this dictionary.
Returns
an enumeration of the keys of this dictionary.
See also
put
public abstract V put(K key, V value)Associate
key with value in this dictionary. If key exists in the dictionary before this call, the old value in the
dictionary is replaced by value.Parameters
keyK- the key to add.
valueV- the value to add.
Returns
the old value previously associated with
key or null if key is new to the dictionary.remove
public abstract V remove(Object key)Removes the key/value pair with the specified
key from this
dictionary.Parameters
keyObject- the key to remove.
Returns
the associated value before the deletion or
null if
key was not known to this dictionary.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.