title: Java iterate over ArrayList with HashMap in it
body: <p>I have a Hashmap with four answers. And I have for ex 2 questions. This is how i do it</p>
  
  <pre><code>    // Awnsers question 1
      antwoorden1.put("Hypertext Preprocessor", true);
      antwoorden1.put("Hypertext PHPprocessor", false);        
      antwoorden1.put("Hypertext processor", false);
      antwoorden1.put("Preprocessor PHP", false);
      // Awnsers question 2
      antwoorden2.put("Model view config", false);
      antwoorden2.put("Model view connect", false);        
      antwoorden2.put("Model view controllers", false);
      antwoorden2.put("Model view controller", true);  
  </code></pre>
  
  <p>Now I need to get access to all this information, so what I do is add the two HashMaps to one ArrayList </p>
  
  <pre><code>    // Add the Hashmaps to the arrayList
      alleAntwoorden.add(antwoorden1);
      alleAntwoorden.add(antwoorden2);
  </code></pre>
  
  <p>But how can I loop through the ArrayList to get the key and value from the HashMap? This is what I already tried.</p>
  
  <pre><code>    for(int i = 0; i &lt; alleAntwoorden.size(); i++)
      {
          for (Map.Entry&lt;String, Boolean&gt; entry : alleAntwoorden.get(i).entrySet())
          {
              String key = entry.getKey();
              Object value = entry.getValue();
              // ...
          }  
      }
  </code></pre>
  
  <p>But I always get the following msg: incompatible types</p>
  
  <p>Antwoorden1, antwoorden2 and alleAntwoorden are defined as: </p>
  
  <pre><code>private ArrayList&lt;HashMap&gt; alleAntwoorden; 
  private HashMap&lt;String, Boolean&gt; antwoorden1, antwoorden2;
  </code></pre>