title: converting java hashMap to another hashMap by grouping some fields
body: <p>I hava a map like that(keys are customer number 1,2,3,4 etc..</p>
  <pre><code>Map&lt;Long,List&lt;Customer&gt;&gt; customerMap = new HashMap&lt;Long, List&lt;Customer&gt;&gt;();
  
  public class Customer {
    private String name;
    private BigDecimal salary;
  
   //..getter and setters
  </code></pre>
  <p>I want to convert it to another map by grouping Name field.What i want to create map like that</p>
  <pre><code>Map&lt;Long,Map&lt;String,CustomerSalary&gt;&gt; convertedMap = new HashMap&lt;Long,Map&lt;String,CustomerSalary&gt;&gt;()();
  
  public class CustomerSalary {
    private BigDecimal salary;
    private BigDecimal remainingSalary;
  
    //getter and setters.
  </code></pre>
  <p>What i did is</p>
  <pre><code> `Map&lt;Long,Map&lt;String,CustomerSalary&gt;&gt; convertedMap =customerMap.entrySet()..stream() 
                  .collect(Collectors.toMap( //collect the entries into another map
                      entry -&gt; entry.getKey(), 
                      entry -&gt; entry.getValue().stream()
                         .collect(groupingBy(Customer::getName,
                          reducing(BigDecimal.ZERO, Customer::getSalary, BigDecimal::add)))
                   ));
  </code></pre>
  <p>but not working because CustomerSalary should be but reducing creates BigDecimal.Do you have any idea?</p>
  <p>Not:Salary and remainingSalary should be same initially.</p>