title: How to compare arraylist with Hasmap and get the key from Hashmap based on value?
body: <p>I've got list :</p>
  
  <pre><code>ArrayList&lt;String&gt; list = new ArrayList&lt;&gt;();
  </code></pre>
  
  <p>and map :</p>
  
  <pre><code>Map&lt;String, List&lt;String&gt;&gt; map = new HashMap&lt;&gt;();
  </code></pre>
  
  <p>I need to compare values of the list and map and return key based on that value</p>
  
  <p>The problem is that I dont know how to synchronize iterations as arraylist has smaller size as each list in map.</p>
  
  <p>Also I tried this method : </p>
  
  <pre><code>public static Object getKeyByValue(Map&lt;String,List&lt;String&gt;&gt; map, String value) {
      for (Entry&lt;String, List&lt;String&gt;&gt; entry : map.entrySet()) {
          if (Objects.equals(value, entry.getValue())) {
              return entry.getKey();
          }
      }
      return null;
  }
  
  getKeyByValue(map,list.get(0)); 
  </code></pre>
  
  <p>..but this call retuned false even If there is certain value...</p>
  
  <p>Any ideas how get each key for each value? 
  Thank you very much</p>