This is follow up question to my original SO question.
Thanks to the answer on that question, it looks like that according to ConcurrentMap.computeIfPresent
javadoc
The default implementation may retry these steps when multiple threads attempt updates including potentially calling the remapping function multiple times.
My question is:
Does ConcurrentHashMap.computeIfPresent
call remappingFunction
multiple times when it is shared between multiple threads only or can also be called multiple times when created and passed from a single thread?
And if it is the latter case why would it be called multiple times instead of once?