public abstract class Dictionary<K,V> extends Object
Map interface for new implementations.
Dictionary is an abstract class which is the superclass of all classes that
associate keys with values, such as Hashtable.
Hashtable| Constructor and Description |
|---|
Dictionary()
Constructs a new instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
abstract Enumeration<V> |
elements()
Returns an enumeration on the elements of this dictionary.
|
abstract V |
get(Object key)
Returns the value which is associated with
key. |
abstract boolean |
isEmpty()
Returns true if this dictionary has no key/value pairs.
|
abstract Enumeration<K> |
keys()
Returns an enumeration on the keys of this dictionary.
|
abstract V |
put(K key,
V value)
Associate
key with value in this dictionary. |
abstract V |
remove(Object key)
Removes the key/value pair with the specified
key from this
dictionary. |
abstract int |
size()
Returns the number of key/value pairs in this dictionary.
|
public abstract Enumeration<V> elements()
keys(),
size(),
Enumerationpublic abstract V get(Object key)
key.key - the key of the value returned.key, or null if the
specified key does not exist.put(K, V)public abstract boolean isEmpty()
true if this dictionary has no key/value pairs,
false otherwise.size()public abstract Enumeration<K> keys()
elements(),
size(),
Enumerationpublic abstract V put(K key, V value)
key with value in this dictionary. If key exists in the dictionary before this call, the old value in the
dictionary is replaced by value.key - the key to add.value - the value to add.key or null if key is new to the dictionary.elements(),
get(java.lang.Object),
keys()public abstract V remove(Object key)
key from this
dictionary.key - the key to remove.null if
key was not known to this dictionary.get(java.lang.Object),
put(K, V)public abstract int size()
elements(),
keys()