title: is Treemap inside ConcurrentHashMap thread safe?
body: <p>I have a case of nested maps as follows:</p>
  
  <pre><code>private final static Map&lt;String, TreeMap&lt;Long,String&gt;&gt; outerConcurrentMap = new ConcurrentHashMap&lt;&gt;();
  </code></pre>
  
  <p>I know that <code>ConcurrentHashMap</code> is thread safe, but I want to know about the <code>TreeMap</code>s this CHM holding, are they also thread safe inside CHM ?</p>
  
  <p>The operations I am doing are:</p>
  
  <ol>
  <li>If specific key is not found --> create new TreeMap and put against key.</li>
  <li>If key is found then get the TreeMap, and update it.</li>
  <li>Retrieve TreeMap from CHM using <code>get(K)</code>.</li>
  <li>Retreive data from TreeMap using <code>tailMap(K,boolean)</code> method.</li>
  <li><code>clear()</code> the CHM.</li>
  </ol>
  
  <p>I want a thread-safe structure in this scenario. Is the above implementation thread-safe or not? If not then please suggest a solution.</p>