Get the key from the value of a list of hashMaps in java
<p>I have 4 hashMaps: </p>

<pre><code>         Map &lt;String, Integer&gt; item1 =new HashMap&lt;String, Integer&gt;();
         Map &lt;String, Integer&gt; item2 =new HashMap&lt;String, Integer&gt;();
         Map &lt;String, Integer&gt; item3 =new HashMap&lt;String, Integer&gt;();
         Map &lt;String, Integer&gt; item4 =new HashMap&lt;String, Integer&gt;();  
</code></pre>

<p>I added the 4 of them to a list:     </p>

<pre><code>       List&lt;Map&gt; Items= new ArrayList&lt;&gt;();
        Items.add(item1);
        Items.add(item2);
        Items.add(item3);
        Items.add(item4);
</code></pre>

<p>I wanted to get the key from the value using the list of hashMaps "Items" So I tried this code:</p>

<pre><code>  for(int i=0; i&lt;n; i++)
            {  
               String key= null;
               int value=v;
              for(Map.Entry entry: Items.get(i).entrySet()){
                  if(value == (entry.getValue())){
                      key = (String) entry.getKey();
                      break;
                  }
              }
</code></pre>

<p>But the Items.get(i).entrySet() doesn't work! </p>

<p>I get these errors: </p>

<pre><code>-Map.Entry is a raw type. References to generic type Map&lt;K,V&gt;.Entry&lt;K,V&gt; should be parameterized
-Type mismatch: cannot convert from element type Object to Map.Entry
-Incompatible operand types int and Object
</code></pre>

<p>Does anyone know how to do it? </p>