All Packages Class Hierarchy This Package Previous Next Index

Class java.util.Dictionary

java.lang.Object | +----java.util.Dictionary
public abstract class Dictionary
extends Object
The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to values. Any non-null object can be used as a key and as a value.

As a rule, the equals method should be used by implementations of this class to decide if two keys are the same.

See Also:
equals, hashCode, Hashtable

Constructor Index

 o Dictionary()

Method Index

 o elements()
Returns an enumeration of the values in this dictionary.
 o get(Object)
Returns the value to which the key is mapped in this dictionary.
 o isEmpty()
Tests if this dictionary maps no keys to value.
 o keys()
Returns an enumeration of the keys in this dictionary.
 o put(Object, Object)
Maps the specified key to the specified value in this dictionary.
 o remove(Object)
Removes the key (and its corresponding value) from this dictionary.
 o size()
Returns the number of keys in this dictionary.

Constructors

 o Dictionary public Dictionary()

Methods

 o size public abstract int size()
Returns the number of keys in this dictionary.

Returns:
the number of keys in this dictionary.
 o isEmpty public abstract boolean isEmpty()
Tests if this dictionary maps no keys to value.

Returns:
true if this dictionary maps no keys to values; false otherwise.
 o keys public abstract Enumeration keys()
Returns an enumeration of the keys in this dictionary.

Returns:
an enumeration of the keys in this dictionary.
See Also:
elements, Enumeration
 o elements public abstract Enumeration elements()
Returns an enumeration of the values in this dictionary. the Enumeration methods on the returned object to fetch the elements sequentially.

Returns:
an enumeration of the values in this dictionary.
See Also:
keys, Enumeration
 o get public abstract Object get(Object key)
Returns the value to which the key is mapped in this dictionary.

Parameters:
key - a key in this dictionary. null if the key is not mapped to any value in this dictionary.
Returns:
the value to which the key is mapped in this dictionary;
See Also:
put
 o put public abstract Object put(Object key, Object value)
Maps the specified key to the specified value in this dictionary. Neither the key nor the value can be null.

The value can be retrieved by calling the get method with a key that is equal to the original key.

Parameters:
key - the hashtable key.
value - the value.
Returns:
the previous value to which the key was mapped in this dictionary, or null if the key did not have a previous mapping.
Throws: NullPointerException
if the key or value is null.
See Also:
equals, get
 o remove public abstract Object remove(Object key)
Removes the key (and its corresponding value) from this dictionary. This method does nothing if the key is not in this dictionary.

Parameters:
key - the key that needs to be removed.
Returns:
the value to which the key had been mapped in this dictionary, or null if the key did not have a mapping.

All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature