title: Grouping by List of Map in Java 8
body: <p>I have a List like this: </p>
  
  <pre><code>List&lt;Map&lt;String, Long&gt;&gt;
  </code></pre>
  
  <p>Is there a way, using lambda, to convert this list to:</p>
  
  <pre><code>Map&lt;String, List&lt;Long&gt;&gt;
  </code></pre>
  
  <p>Example: </p>
  
  <pre><code>Map&lt;String, Long&gt; m1 = new HashMap&lt;&gt;();
  m1.put("A", 1);
  m1.put("B", 100);
  
  Map&lt;String, Long&gt; m2 = new HashMap&lt;&gt;();
  m2.put("A", 10);
  m2.put("B", 20);
  m2.put("C", 100);
  
  List&lt;Map&lt;String, Long&gt;&gt; beforeFormatting = new ArrayList&lt;&gt;();
  beforeFormatting.add(m1);
  beforeFormatting.add(m2);
  </code></pre>
  
  <p>After formatting: </p>
  
  <pre><code>Map&lt;String, List&lt;Long&gt;&gt; afterFormatting;
  </code></pre>
  
  <p>which would look like:</p>
  
  <pre><code>A -&gt; [1, 10]
  B -&gt; [100, 20]
  C -&gt; [100]
  </code></pre>