« first day (3030 days earlier)      last day (24 days later) » 

3:21 PM
@BobCross I find myself questioning Javan wisdom today. Why does Map.putIfAbsent exist? Isn't it just a prettier version of if ( ! map.containsKey(key) ) ... map.put(key); ... ?
 
 
6 hours later…
9:01 PM
@Zaid for the default Map interface, yes but...
The method signature gives you an entry point for a threadsafe map (e.g. ConcurrentMap):
The second definition specifies that putIfAbsent will be atomic and will not cause race conditions in a multi-threaded environment.
All that said, I prefer computeIfAbsent for a few reasons (including that it seems to avoid some of the confusion).
 

« first day (3030 days earlier)      last day (24 days later) »