remove(Object key) deletes an entry by a key

 
import java.util.HashMap;
import java.util.Map;

public class Main {
  public static void main(String[] a) {

    Map<String,String> map = new HashMap<String,String>();
    map.put("key1", "value1");
    map.put("key2", "value2");
    map.put("key3", "value3");
    map.remove("key3");

    System.out.println(map);
  }
}
  
Home 
  Java Book 
    Collection  

HashMap:
  1. HashMap Class
  2. new HashMap<K, V>()
  3. clear() removes all elements in a HashMap
  4. clone() creates a copy of the HashMap
  5. containsKey(Object key) checks to see if the HashMap has that key
  6. containsValue(Object value) checks if the HashMap has that value
  7. entrySet() returns the key-value pair as a set
  8. keySet() returns the key set
  9. get(E o) returns the value by the key
  10. put(E o, E o1) add value and key to a HashMap
  11. putAll(Map<?, ?> m) adds another map
  12. remove(Object key) deletes an entry by a key
  13. size() returns the size of a HashMap
  14. values() returns the value of the