@Override public void run(String... args) throws Exception { ConcurrentHashMap<String, String> concurrentHashMap = new ConcurrentHashMap<>(); concurrentHashMap.put(null, "1");//npe concurrentHashMap.put("1", null);//npe concurrentHashMap.get(null);//npe HashMap<String, String> hashMap = new HashMap<>(); hashMap.put(null, "1");//ok hashMap.put("1", null);//ok System.out.println(hashMap.get(null));//"1" System.out.println(hashMap.get("1"));//null }