title: Recursive iteration of a Map Java
body: <p>I am writing a recursive function whose purpose is to iterate over the pList File. My code is </p>
  
  <pre><code>public static void HashMapper(Map lhm1) throws ParseException {
  
      //Set&lt;Object&gt; set = jsonObject.keySet();
      for (Object entry : lhm1.entrySet()) {
          if(entry instanceof String)
          {
              System.out.println(entry.toString());
          }
          else
          {
              HashMapper((Map) ((Map) entry).keySet()); //getting Exception java.util.HashMap$HashMap Entry cannot be cast to java.util.Map
          }
      }
  }
  </code></pre>
  
  <p>But when i am calling my function "HashMapper((Map) ((Map) entry).keySet());". I am getting an exception of </p>
  
  <blockquote>
    <p>java.util.HashMap$HashMap Entry cannot be cast to java.util.Map</p>
  </blockquote>
  
  <p>I donot know how to call my function and how can i convert Hashmap entry to Map</p>