Implementation:

Data_StructureAbstract_Data_TypeAVL_TreeHash_Table


Map is an abstract data type that contains key-value pairs. In map, every key has to be unique. In java, HashMap and HashTable implement the Map interface.

Operations

  • put(key, value) Add a new key-value pair into the map. If the key is already exists in the map, the old value is replaced by the new.
  • get(key) A key is passed as parameter, the corresponding value is returned.
  • remove(key) A key is passed as parameter, the associate key-value pair is removed from the map.
  • containsKey(key) Checks if the map contains a mapping for the specified key. Returns true if the map contains the key, otherwise returns false.
  • containsValue(value) Checks if the map contains one or more keys mapping to the specified value. Returns true if the map contains at least one key-value pair with the specified value, otherwise returns false.

Back to parent page: Data Structures and Algorithms