About Question enthuware.ocpjp.v8.2.1509 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
__JJ__
Posts: 125
Joined: Thu Jul 05, 2018 6:44 pm
Contact:

About Question enthuware.ocpjp.v8.2.1509 :

Post 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}

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests