title: java.lang.ClassCastException cannot be cast to java.util.Map$Entry
body: <p>I have this problem I can't solve : </p>
  
  <p>I'm getting some data from fire base database. 
  Every thing works fins except when I reach the <strong>title</strong> column
  because the title column is a json tree and it have a key values rows so a new logic must be writen here.</p>
  
  <p><strong>What I tried so far</strong><br>
   Create an entry for it and save it in hash map inside my ConfigItem class that I created.</p>
  
  <p>I receive the data just fine, but I don't know who to loop through it. </p>
  
  <p>When I reach the third line in the while loop, I got<code>java.lang.ClassCastException: java.util.HashMap$EntrySet cannot be cast to java.util.Map$Entry</code></p>
  
  <p>What I'm missing here? </p>
  
  <pre><code>public class DataMappingConfig implements DataMappingStrategy {
  
  @Override
  public Object mapData(HashMap&lt;String, Object&gt; data ) {
  
      Log.i("key set " , data.keySet().toString() + " key set ") ;
      HashMap&lt;String , Object &gt; mpair  =null ;
      HashMap&lt;String, String&gt; titlepairs = null ;
  
      for (String key : data.keySet()) {
          if (key.equals(KEY_TITLE)) {
  
              final Iterator iterator = data.entrySet().iterator();
  
              while (iterator.hasNext()){
                  mpair = new HashMap&lt;String , Object &gt;() ;
                  Map.Entry&lt;String, Object&gt; pair = (Map.Entry&lt;String , Object&gt;) data.entrySet() ;
                  HashMap&lt;String,HashMap&lt;String , String&gt;&gt; titleMap = (HashMap&lt;String, HashMap&lt;String, String&gt;&gt;) pair.getValue();
                  titlepairs = new HashMap&lt;String, String&gt;();;
  
              }
          }
      }
          ConfigItem conf = new ConfigItem();
          if (data.containsKey(KEY_LOGIN)) {
              conf.setLogin((Boolean) data.get(KEY_LOGIN)); // note the import above
          }
          if (data.containsKey(KEY_ICON)) {
              conf.setIcon((String) data.get(KEY_ICON));
          }
          if (data.containsKey(KEY_MAIN_SCREEN_ORDER)) {
              conf.setNum(safeLongToInt((Long) data.get(KEY_MAIN_SCREEN_ORDER)));
          }
          if (data.containsKey(KEY_MODE)) {
              String modeValue = (String) data.get(KEY_MODE);
              if (modeValue.equals(VALUE_MODE_EMERGENCY)) {
                  conf.setEmenrgency(true);
              } else if (modeValue.equals(VALUE_MODE_ROUTINE)) {
                  conf.setRoutine(true);
              }
              conf.setMode((String) data.get(KEY_MODE));
          }
          if (data.containsKey(KEY_STATUS)) {
              conf.setStatus((String) data.get(KEY_STATUS));
          }
          if (data.containsKey(KEY_SHOW_DATE)) {
              try {
  
                  conf.setShowDate((Boolean) data.get(KEY_SHOW_DATE));
              } catch (IllegalArgumentException e) {
                  e.printStackTrace();
                  Log.i("ERROR", "" + e.getLocalizedMessage());
              }
          }
  
  
          Log.i("Data Map config ", "conf item = " + conf.toString() + "\n");
  
  
          return conf;
      }
  
  }
  </code></pre>