Java Dictionary Class
The Dictionary class is an abstract class used to store key/value pairs, similar to the Map class.
By providing a key and a value, you can store the value in a Dictionary object. Once the value is stored, you can retrieve it using its key. Just like a Map, a Dictionary can also be seen as a list of key/value pairs.
The abstract methods defined by Dictionary are shown in the table below:
| Number | Method Description | | 1 | Enumeration elements() <br>Returns an enumeration of the values in this dictionary. | | 2 | Object get(Object key) <br>Returns the value to which this dictionary maps the specified key. | | 3 | boolean isEmpty() <br>Tests if this dictionary maps no keys to values. | | 4 | Enumeration keys() <br>Returns an enumeration of the keys in this dictionary. | | 5 | Object put(Object key, Object value) <br>Maps the specified key to the specified value in this dictionary. | | 6 | Object remove(Object key) <br>Removes the key (and its corresponding value) from this dictionary. | | 7 | int size() <br>Returns the number of entries (distinct keys) in this dictionary. |
The Dictionary class is obsolete. In practical development, you can implement the Map interface to achieve key/value storage functionality.