title: Stream api collectors grouping by zero counted fileds
body: <p>I have an object has a filed type1 used to create first group and i have two fields are used to create second group. But second group always get one of theese three values (X,Y,Z). At this point i wrote a code like this :</p>
  
  <pre><code>Map&lt;String, Map&lt;String, Long&gt;&gt; result = objList.stream()
              .collect(Collectors.groupingBy(Obj::type1,
                       Collectors.groupingBy(Obj::useTwoFieldToGetSecondGroup, Collectors.counting())))
  </code></pre>
  
  <p>As result of this code i get this :</p>
  
  <pre><code>{
    "A":{
       "Y":5,
       "Z":3
    },
    "B":{
       "Y":2,
       "Z":1
    },
    "C":{
       "X":2
    },
    "D":{
       "X":6,
       "Z":2
    }
  </code></pre>
  
  <p>}</p>
  
  <p>But i know second type has always three types of values and i want to see sth like this : </p>
  
  <pre><code>{
    "A":{
       "X":0,
       "Y":5,
       "Z":3
    },
    "B":{
       "X":0,
       "Y":2,
       "Z":1
    },
    "C":{
       "X":2,
       "Y":0,
       "Z":0
    },
    "D":{
       "X":6,
       "Y":0,
       "Z":2
    }
  </code></pre>
  
  <p>}</p>
  
  <p>are there any vay to get this result easily?</p>
  
  <pre><code>public classObj {
  
     private String type1; //key of first map
  
     private String field1; //second key calculated with this two fields
     private String field2;
  
     public String useTwoFieldToGetSecondGroup(){
         //use field1 and field2 to get X or Y or Z
     }
  
  }
  </code></pre>
  
  <p>and useTwoFieldToGetSecondGroup method like this:</p>
  
  <pre><code>private String useTwoFieldToGetSecondGroup() {
      if(field1 &amp;&amp; field2){
          return "X";
      } else if(!field1 &amp;&amp; field2){
          return "Y";
      } else {
          return "Z";
      }
  }
  </code></pre>