java - Interleaving two threads such that one of the thread gets null when called putIfAbsent of concurrentHashMap -
can explain interleaving of 2 threads such 1 of thread gets null when 2 threads call putifabsent
of concurrenthashmap
in java?
from javadoc of putifabsent
:
returns:
previous value associated specified key, or null if there no mapping key.
so first thread attempting put value in map have null
returned it.
Comments
Post a Comment