# Class Dictionary<K,V>

java.lang.Object
java.util.Dictionary<K,V>

Direct Known Subclasses:
  `Hashtable`

public abstract class Dictionary<K,V> extends Object
Note: Do not use this class since it is obsolete. Please use the `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`.

Since:
  1.0
See Also:
  - `Hashtable`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Dictionary()`
  Constructs a new instance of this class.

- ## Method Summary

  Modifier and Type
  Method
  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.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `final Class`
  `getClass()`
  Returns the runtime class of an object.
  `int`
  `hashCode()`
  Returns a hash code value for the object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `String`
  `toString()`
  Returns a string representation of the object.
  `final void`
  `wait()`
  Causes current thread to wait until another thread invokes the method or the method for this object.
  `final void`
  `wait(long timeout)`
  Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
  `final void`
  `wait(long timeout, int nanos)`
  Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.

- ## Constructor Details

  - ### Dictionary

    public Dictionary()
    Constructs a new instance of this class.

- ## Method Details

  - ### elements

    public abstract Enumeration<V> elements()
    Returns an enumeration on the elements of this dictionary.
    Returns:
      an enumeration of the values of this dictionary.
    See Also:
      - `keys()`
      - `size()`
      - `Enumeration`

  - ### get

    public abstract V get(Object key)
    Returns the value which is associated with `key`.
    Parameters:
      `key` - the key of the value returned.
    Returns:
      the value associated with `key`, or `null` if the specified key does not exist.
    See Also:
      - `put(K, V)`

  - ### isEmpty

    public abstract boolean isEmpty()
    Returns true if this dictionary has no key/value pairs.
    Returns:
      `true` if this dictionary has no key/value pairs, `false` otherwise.
    See Also:
      - `size()`

  - ### keys

    public abstract Enumeration<K> keys()
    Returns an enumeration on the keys of this dictionary.
    Returns:
      an enumeration of the keys of this dictionary.
    See Also:
      - `elements()`
      - `size()`
      - `Enumeration`

  - ### put

    public abstract V put(K key, V value)
    Associate `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`.
    Parameters:
      `key` - the key to add.
      `value` - the value to add.
    Returns:
      the old value previously associated with `key` or `null` if `key` is new to the dictionary.
    See Also:
      - `elements()`
      - `get(Object)`
      - `keys()`

  - ### remove

    public abstract V remove(Object key)
    Removes the key/value pair with the specified `key` from this dictionary.
    Parameters:
      `key` - the key to remove.
    Returns:
      the associated value before the deletion or `null` if `key` was not known to this dictionary.
    See Also:
      - `get(Object)`
      - `put(K, V)`

  - ### size

    public abstract int size()
    Returns the number of key/value pairs in this dictionary.
    Returns:
      the number of key/value pairs in this dictionary.
    See Also:
      - `elements()`
      - `keys()`