The following example shows Map data manipulation.
HashMap and Hashtable are two implementations of Map interface.
Hashtable is synchronized where as HashMap is not.
Map provides the following APIs,
public int size();
- Returns the number of entries in the Map.
public boolean isEmpty();
- Returns true if the Map contains more than one entry otherwise returns false.
public V put(K paramK, V paramV);
- Puts a key value pair as an entry in Map.
public void putAll(Map<? extends K, ? extends V> paramMap);
- Copies all Map entries from specified Map.
public V remove(Object paramObject);
- Removes the specified entry from Map.
public void clear();
- Removes all entries from Map.