You can use either of the following
1) Use the keySet
Set keys = addressBook.keySet();
for (Iterator i = keys.iterator(); i.hasNext();) {
String key = (String) i.next();
String value = (String) addressBook.get(key);
System.out.println("key=" + key + ", value=" + value);
}
or use the Hashmap values method which returns a Collection view of the values contained in the map
for (String value : addressBook.values()) {
System.out.println("value=" + value);
}
or directly print the collection returned by values using Arrays
System.out.println("addressBook.values =" + Arrays.asList(addressBook.values()));