title: Converting ConcurrentHashMap to HashMap
body: <p>Is it possible to convert <code>ConcurrentHashMap</code> to <code>HashMap</code> in java ?</p>
  
  <p>This is my sample program where i was converting from <code>ConcurrentHashMap</code> to <code>HashMap</code> but i was getting the following exception:</p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.ClassCastException: 
    java.util.concurrent.ConcurrentHashMap cannot be cast to java.util.HashMap
    at com.Hi.main(Hi.java:18)</p>
  </blockquote>
  
  <p>My code:</p>
  
  <pre><code>package com;
  
  import java.util.HashMap;
  import java.util.Map;
  import java.util.concurrent.ConcurrentHashMap;
  
  public class Hi {
  
      public static void main(String args[]) {
  
          Map&lt;String, String&gt; conpage = new ConcurrentHashMap&lt;String, String&gt;();
  
          conpage.put("1", "A");
          conpage.put("2", "B");
          conpage.put("3", "C");
  
          HashMap hm = (HashMap) conpage;
  
          System.out.println(hm.get("1"));
  
      }
  
  }
  </code></pre>