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<Entry<K, V>> entrySet();
- Returns all Entries in the Map as a Set.