title: List<Map<String, Object>> to List<Map<String, Object>> group by key with nulls
body: <p>I have a use case where I need to merge multiple rows from a query with the same key.</p>
  <p>Input (List&lt;Map&lt;String, Object&gt;&gt;):</p>
  <pre><code>[
  {&quot;brand&quot;: &quot;A&quot;, &quot;sum of A&quot;: NULL, &quot;sum of B&quot;: NULL, &quot;sum of C&quot;: NULL, &quot;sum of D&quot;: NULL},
  {&quot;brand&quot;: &quot;B&quot;, &quot;sum of A&quot;: 2700, &quot;sum of B&quot;: 1500, &quot;sum of C&quot;: NULL, &quot;sum of D&quot;: NULL},
  {&quot;brand&quot;: &quot;B&quot;, &quot;sum of A&quot;: NULL, &quot;sum of B&quot;: NULL, &quot;sum of C&quot;: 1700, &quot;sum of D&quot;: NULL},
  {&quot;brand&quot;: &quot;C&quot;, &quot;sum of A&quot;: 3000, &quot;sum of B&quot;: NULL, &quot;sum of C&quot;: NULL, &quot;sum of D&quot;: NULL},
  {&quot;brand&quot;: &quot;C&quot;, &quot;sum of A&quot;: NULL, &quot;sum of B&quot;: NULL, &quot;sum of C&quot;: 6000, &quot;sum of D&quot;: NULL},
  {&quot;brand&quot;: &quot;D&quot;, &quot;sum of A&quot;: 1000, &quot;sum of B&quot;: 2000, &quot;sum of C&quot;: 4000, &quot;sum of D&quot;: 600}
  ]
  </code></pre>
  <p>Expected output (List&lt;Map&lt;String, Object&gt;&gt;):</p>
  <pre><code>[
  {&quot;brand&quot;: &quot;A&quot;, &quot;sum of A&quot;: NULL, &quot;sum of B&quot;: NULL, &quot;sum of C&quot;: NULL, &quot;sum of D&quot;: NULL},
  {&quot;brand&quot;: &quot;B&quot;, &quot;sum of A&quot;: 2700, &quot;sum of B&quot;: 1500, &quot;sum of C&quot;: 1700, &quot;sum of D&quot;: NULL},
  {&quot;brand&quot;: &quot;C&quot;, &quot;sum of A&quot;: 3000, &quot;sum of B&quot;: NULL, &quot;sum of C&quot;: 6000, &quot;sum of D&quot;: NULL},
  {&quot;brand&quot;: &quot;D&quot;, &quot;sum of A&quot;: 1000, &quot;sum of B&quot;: 2000, &quot;sum of C&quot;: 4000, &quot;sum of D&quot;: 600}
  ]
  </code></pre>
  <p><strong>How can I achieve this with Java stream API?</strong>
  I can't use POJO because the data is always different, but I always know what is the name of the key (ex.: brand in that case).
  As you can see I always need the value instead of the NULL, but if there is no value, then we can use the NULL in the output.</p>
  <p>And there is always only ONE value for the same key in the same column. So this is invalid input:</p>
  <pre><code>[
  {&quot;brand&quot;: &quot;B&quot;, &quot;sum of A&quot;: 2700, &quot;sum of B&quot;: 1500, &quot;sum of C&quot;: NULL, &quot;sum of D&quot;: NULL},
  {&quot;brand&quot;: &quot;B&quot;, &quot;sum of A&quot;: 1400, &quot;sum of B&quot;: NULL, &quot;sum of C&quot;: 1700, &quot;sum of D&quot;: NULL}
  ]
  </code></pre>
  <p>I don't need the exact return type for the output as long as it is easy to convert to JSON formatted String.</p>