title: java 8 grouping a map of same key and value and make a key value pair
body: <p>I have a method <code>fetchConfigsCount()</code> which returns <code>List&lt;Map&lt;String, Object&gt;&gt;</code>.</p>
  <p>The result looks like:</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;web_id&quot;: &quot;abc&quot;,
      &quot;count&quot;: 1
  },
  {
      &quot;web_id&quot;: &quot;xyz&quot;,
      &quot;count&quot;: 1
  },
  {
      &quot;web_id&quot;: &quot;pqr&quot;,
      &quot;count&quot;: 1
  }
  </code></pre>
  <p>We have another method <code>fetchWebsitesCount()</code> which also returns a response in same format.</p>
  <p><code>web_id</code> is the key and its value is owner name.
  <code>count</code> is another key and its value is of type <code>int</code>.</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;web_id&quot;: &quot;abc&quot;,
      &quot;count&quot;: 2
  },
  {
      &quot;web_id&quot;: &quot;xyz&quot;,
      &quot;count&quot;: 3
  },
  {
      &quot;web_id&quot;: &quot;pqr&quot;,
      &quot;count&quot;: 4
  }
  </code></pre>
  <p>We have a list of owners which is of type <code>ArrayList&lt;String&gt;</code>:</p>
  <pre class="lang-java prettyprint-override"><code>List&lt;String&gt; listOfOwners = [&quot;abc&quot;,&quot;xyz&quot;,&quot;pqr&quot;];
  </code></pre>
  <p>I want to collect all these things and want to create a result like below:</p>
  <pre class="lang-json prettyprint-override"><code>result:[
      {&quot;owner&quot;: &quot;abc&quot;,
      &quot;ownerPresence&quot;:{
      &quot;configCount&quot;:1,
      &quot;websiteCount&quot;:2
      },
      {&quot;owner&quot;: &quot;xyz&quot;,
      &quot;ownerPresence&quot;:{
      &quot;configCount&quot;:1,
      &quot;websiteCount&quot;:3
      },
      {&quot;owner&quot;: &quot;pqr&quot;,
      &quot;ownerPresence&quot;:{
      &quot;configCount&quot;:1,
      &quot;websiteCount&quot;:4
      }]
  </code></pre>
  <p>I am not sure how I can do this in Java 8.</p>