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 -

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -