title: Java : java.lang.Double cannot be cast to java.lang.String
body: <p><strong>I am storing a double value inside the a HashMap as shown</strong> </p>
  
  <pre><code>HashMap listMap = new HashMap();
  
  double mvalue =0.0;
  
  listMap.put("mvalue",mvalue );
  </code></pre>
  
  <p><strong>Now when i tried to retrieve that value , as shown</strong> </p>
  
  <pre><code>mvalue = Double.parseDouble((String) listMap.get("mvalue"));
  </code></pre>
  
  <p>i am getting an error as </p>
  
  <p><strong>java.lang.Double cannot be cast to java.lang.String</strong> </p>
  
  <p>I am confused here , </p>
  
  <p><strong>This is my actual HashMap and i am setting the values in it as shown</strong> </p>
  
  <pre><code>HashMap listMap = new HashMap();
  double mvalue =0.0 ;
  List&lt;Bag&gt; bagList = null; 
  listMap.put("bagItems",bagList);
  listMap.put("mvalue", mvalue);
  </code></pre>
  
  <p><strong>Could anybody please tell me , how the structure of the HashMap should be ?</strong></p>