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
Dictionary()
elements() - Returns an enumeration of the values in this dictionary.
get(Object) - Returns the value to which the key is mapped in this dictionary.
isEmpty() - Tests if this dictionary maps no keys to value.
keys() - Returns an enumeration of the keys in this dictionary.
put(Object, Object) - Maps the specified
key to the specified value in this dictionary.
remove(Object) - Removes the
key (and its corresponding value) from this dictionary.
size() - Returns the number of keys in this dictionary.
Dictionary
public Dictionary()
size
public abstract int size()
- Returns the number of keys in this dictionary.
- Returns:
- the number of keys in this dictionary.
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.
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
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
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
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
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 - Version 1.1.8 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1995-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.