Reducing Map by using Java 8 Stream API
<p>I have a Map in the following form:</p>

<pre><code>Map&lt;Integer, Map&lt;String,Double&gt;&gt; START
</code></pre>

<p>Let INNER be the inner map, i.e. </p>

<pre><code>Map&lt;String,Double&gt;
</code></pre>

<p>For example, I'd like to reduce START map in a new one</p>

<pre><code>Map&lt;Integer, Double&gt; END
</code></pre>

<p>which have the same keys, but different values.
In particular, for each key, I want the new Double value be the SUM of values in the INNER map for the corresponding key.</p>

<p>How could I achieve this by using JAVA 8's STREAM API?</p>

<p>Thanks everyone. </p>

<p>EDIT: A sample map is</p>

<pre><code>------------------------------
|      |  2016-10-02   3.45   |
| ID1  |  2016-10-03   1.23   |
|      |  2016-10-04   0.98   |
------------------------------
|      |  2016-10-02   1.00   |
| ID2  |  2016-10-03   2.00   |
|      |  2016-10-04   3.00   |
------------------------------
</code></pre>

<p>e I'd like a new map like the following one:</p>

<pre><code>--------------------------------
|      |                       |
| ID1  |  SUM(3.45,1.23,0.98)  |
|      |                       |
--------------------------------
|      |                       |
| ID2  |  SUM(1.00,2.00,3.00)  |
|      |                       |
--------------------------------
</code></pre>