In computer science, an associative array/dictionary/Map is a data structure represented by a collection of key/value pairs. Arrays, like int[] or String[] can be thought of as a Map with only increasing integer keys. Maps are very widely used in the real world, such as associating a username with a password or an ID number with a database entry.
According to Wikipedia,
The operations that are usually defined for an associative array are:
We will explore a simple implementation of a Map, which while not very efficient, is very easy to understand and implement. It should have the following methods at minimum:
public void set(K key, V val) - Add a key-value pair to the Mappublic V get(K key) - Get the value associated with a keypublic void updateValueForKey(K key, V val) - Update the value associated with a keypublic String toString() - Convert the Map to a String