title: Filter List<Map<String, String>> using streams
body: <p>I need to filter a list <code>List&lt;Map&lt;String, String&gt;</code>> by value (if map have searched value, then map add to list) using streams. I'm trying to do this:</p>
  
  <pre><code>static Map&lt;String, String&gt; map1 = new HashMap&lt;&gt;();
  static Map&lt;String, String&gt; map2 = new HashMap&lt;&gt;();
  static Map&lt;String, String&gt; map3 = new HashMap&lt;&gt;();
  
  static {
      map1.put("key", "value");
      map1.put("key2", "value2");
  
      map2.put("key3", "value3");
      map2.put("key2", "value2");
  
      map3.put("key3", "value3");
      map3.put("key4", "value4");
  }
  
  public static void main(String[] args) {
      List&lt;Map&lt;String, String&gt;&gt; list = new ArrayList&lt;&gt;();
      Map&lt;String, String&gt; resultMap = new HashMap&lt;&gt;();
  
      list.add(map1);
      list.add(map2);
      list.add(map3);
  
      List&lt;Map&lt;String, String&gt;&gt; result = list.stream()
              .flatMap(map -&gt; map.entrySet().stream())
              .filter(value -&gt; value.getValue().equals("value2"))
              .map(x -&gt; resultMap.put(x.getKey(), x.getValue()))
              .collect(Collectors.toList());
  
  }
  </code></pre>
  
  <p>For execution this code i have error: 
  java: incompatible types: inference variable T has incompatible bounds
      equality constraints: java.util.Map
      lower bounds: java.lang.String</p>