public abstract class Dictionary<K,V> extends Object
Dictionaryclass is the abstract parent of any class, such as
Hashtable, which maps keys to values. Every key and every value is an object. In any one Dictionary object, every key is associated with at most one value. Given a Dictionary and a key, the associated element can be looked up. Any non-
nullobject 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.
NOTE: This class is obsolete. New implementations should implement the Map interface, rather than extending this class.
|Constructor and Description|
|Modifier and Type||Method and Description|
Returns an enumeration of the values in this dictionary.
Returns the value to which the key is mapped in this dictionary.
Tests if this dictionary maps no keys to value.
Returns an enumeration of the keys in this dictionary.
Maps the specified
Returns the number of entries (distinct keys) in this dictionary.
public abstract int size()
public abstract boolean isEmpty()
trueif this dictionary maps no keys to values;
public abstract Enumeration<K> keys()
public abstract Enumeration<V> elements()
keyto the specified
valuein this dictionary. Neither the key nor the value can be
If this dictionary already contains an entry for the specified key, the value already in this dictionary for that key is returned, after modifying the entry to contain the new element.
If this dictionary does not already have an entry for the specified key, an entry is created for the specified key and value, and null is returned.
value can be retrieved by calling the
get method with a
key that is equal to
key- the hashtable key.
value- the value.
keywas mapped in this dictionary, or
nullif the key did not have a previous mapping.
NullPointerException- if the
key(and its corresponding
value) from this dictionary. This method does nothing if the
keyis not in this dictionary.
key- the key that needs to be removed.
keyhad been mapped in this dictionary, or
nullif the key did not have a mapping.
NullPointerException- if key is null.
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2013, Oracle and/or its affiliates. All rights reserved.