title: Java - ThreadLocal vs ConcurrentHashMap
body: <p>I have a very simple question regarding a performance difference between <code>ThreadLocal</code> and <code>ConcurrentHashMap</code>. In some places in my code I need to maintain a mapping from a <code>Thread</code> to some <code>Object</code>, which has to be thread safe. One option is to use <code>ConcurrentHashMap</code> and one is to use <code>ThreadLocal</code>. Any advantages/disadvantages for either of these approaches, mostly in terms of speed?</p>