title: Merge Map<String, List<String> Java 8 Stream
body: <p>I would like to merge two Map with JAVA 8 Stream:</p>
  
  <pre><code>Map&lt;String, List&lt;String&gt;&gt; mapGlobal = new HashMap&lt;String, List&lt;String&gt;&gt;();
  Map&lt;String, List&lt;String&gt;&gt; mapAdded = new HashMap&lt;String, List&lt;String&gt;&gt;();
  </code></pre>
  
  <p>I try to use this implementation:</p>
  
  <pre><code>mapGlobal = Stream.of(mapGlobal, mapAdded)
                  .flatMap(m -&gt; m.entrySet().stream())
                  .collect(Collectors.groupingBy(Map.Entry::getKey,
                          Collectors.mapping(Map.Entry::getValue,        
                                             Collectors.toList())
                  ));
  </code></pre>
  
  <p>However, this implementation only create a result like:</p>
  
  <p><code>Map&lt;String, List&lt;Object&gt;&gt;</code></p>
  
  <p>If one key is not contained in the <code>mapGlobal</code>, it would be added as a new key with the corresponding List of String. If the key is duplicated in <code>mapGlobal</code> and <code>mapAdded</code>, both list of values will be merge as: <code>A = {1, 3, 5, 7}</code> and <code>B = {1, 2, 4, 6}</code> then <code>A ∪ B = {1, 2, 3, 4, 5, 6, 7}</code>.</p>