java: is the function thread-safe in hashmap.put(key, function())?
<p>I want to put a value returned from a function into ConcurrentHashmap like that</p>

<pre><code>private static ConcurrentHashMap&lt;String, Object&gt; map = new ConcurrentHashMap&lt;String, Object&gt;();

public void process() {
    map.put(key, function());
}

public Object function() {
    return anyObject;
}
</code></pre>

<p>May I know the function (e.g. function()) is thread-safe or not?
Please advise if there is any tutorial 
Thanks.</p>
