Class java.util.Dictionary
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.util.Dictionary

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.

Version:
1.8, 07/01/98
Author:
unascribed
Since:
JDK1.0
See Also:
equals(java.lang.Object), hashCode(), Hashtable

Constructor Index

 o java.util.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 elements
public abstract java.util.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.
Since:
JDK1.0
See Also:
keys(), Enumeration
 o get
public abstract java.lang.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;
Since:
JDK1.0
See Also:
put(java.lang.Object, java.lang.Object)
 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.
Since:
JDK1.0
 o keys
public abstract java.util.Enumeration keys()
Returns an enumeration of the keys in this dictionary.

Returns:
an enumeration of the keys in this dictionary.
Since:
JDK1.0
See Also:
elements(), Enumeration
 o put
public abstract java.lang.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.
Since:
JDK1.0
See Also:
equals(java.lang.Object), get(java.lang.Object)
 o remove
public abstract java.lang.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.
Since:
JDK1.0
 o size
public abstract int size()
Returns the number of keys in this dictionary.

Returns:
the number of keys in this dictionary.
Since:
JDK1.0

All Packages  Class Hierarchy  This Package  Previous  Next  Index