Java Dictionary Class
# Java Dictionary Class
[Java Data Structures](#)
* * *
The Dictionary class is an abstract class used to store key/value pairs, functioning similarly to the Map class.
Given a key and a value, you can store the value in a Dictionary object. Once the value is stored, it can be retrieved by its key. Therefore, like a Map, a Dictionary can also be viewed as a list of key/value pairs.
The abstract methods defined in the Dictionary class are shown in the following table:
**No.** **Method Description**
1**Enumeration elements( )**
Returns an enumeration of the values in this dictionary.
2**Object get(Object key)**
Returns the value to which the specified key is mapped in this dictionary.
3**boolean isEmpty( )**
Tests if this dictionary maps no keys to values.
4**Enumeration keys( )**
Returns an enumeration of the keys in this dictionary.
5**Object put(Object key, Object value)**
Maps the specified key to the specified value in this dictionary.
6**Object remove(Object key)**
Removes the key (and its corresponding value) from this dictionary.
7**int size( )**
Returns the number of entries (distinct keys) in this dictionary.
The Dictionary class is obsolete. In practical development, you can (#) to obtain key/value storage functionality.
* * Java Data Structures](#)
YouTip