Package java.util |
![]() Previous |
![]() Java API |
![]() Index |
![]() Next |
public abstract class java.util.Dictionary extends java.lang.Object { // Constructors public Dictionary(); // Methods public abstract Enumeration elements(); public abstract Object get(Object key); public abstract boolean isEmpty(); public abstract Enumeration keys(); public abstract Object put(Object key, Object value) public abstract Object remove(Object key); public abstract int size(); }
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 implements of this class to decide if two keys are the same.
See Also: | hashCode in class Object . |
public Dictionary()The default constructor.
public abstract Enumeration elements()Return Value:
Returns An enumeration of the values in the dictionary.
See Also: keys .
public abstract Object get(Object key)Return Value:
Returns the value to which the key is mapped in this dictionary; null if the key is not mapped to any value is thise dictionary.
Parameter Description key a key in this dictionary See Also: put .
public abstract boolean isEmpty()Return Value:
Returns true if this dictionary maps no keys to values; false otherwise.
public abstract Enumeration keys()Return Value:
Returns An enumeration of the keys in this dictionary.
See Also: elements .
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 the get method with a key that is equal to the original key.
Return Value:
Returns the previous value to which the key was mapped in the dictionary, or null if the key did not have a previous mapping.
Parameter Description key the hashtable key value the value. Throw:
If the key or value is null.
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.
Return Value:
Returns the value to which the key had been mapped in this dictionary, or null if the key did not have a mapping.
Parameter Description key the key that needs to be removed
public abstract int size()Return Value:
Returns the number of keys in this dictionary.