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

Popular posts from this blog

c# - Class in a list -

mysql - Django database model for my website -

ios - How to run a segue on itself OR another viewController -