Page 1 of 1

About Question enthuware.ocpjp.v8.2.1509 :

Posted: Fri Aug 03, 2018 8:18 am
by __JJ__
Hi
Of course, if k/null exists, then for many of these methods (merge, putIfAbsent, computeIfAbsent etc) then k/null is semantically the same as k does not exist.

Code: Select all

        Map m = new HashMap();
        m.put(1,null);
        m.putIfAbsent(1,10);
        System.out.println(m);     //{1=10}