Lecture Videos
  1  public class TestMyHashMap {
  2    public static void main(String[] args) {
  3      // Create a map
  4      MyMap<String, Integer> map = new MyHashMap<>();
  5      map.put("Perez", 30); // Add Perez with age 30 to map
  6      map.put("Anderson", 31);
  7      map.put("Lewis", 29);
  8      map.put("Cook", 29);
  9      map.put("Perez", 65); // Add Perez with age 65 to map
 10  
 11      System.out.println("Entries in map: " + map);
 12  
 13      System.out.println("The age for " + "Lewis is " +
 14        map.get("Lewis"));
 15  
 16      System.out.println("Is Perez in the map? " + 
 17        map.containsKey("Perez"));
 18      System.out.println("Is age 33 in the map? " + 
 19        map.containsValue(33));
 20  
 21      map.remove("Smith"); // Remove Perez from map
 22      System.out.println("Entries in map: " + map);
 23  
 24      map.clear();
 25      System.out.println("Entries in map: " + map);
 26    }
 27  }