The following example shows creating a Map and iterating its entries.
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 Set keySet();
- Returns all keys in the Map as a Set.