title: Collectors.groupingBy for optional field's inner field
body: <p>I'd like to map a stream <code>Stream&lt;Car&gt;</code> to the map like <code>Map&lt;String, List&lt;Car&lt;StudentInGroup&gt;&gt;&gt;</code> where <code>Car</code> class is like this:</p>
  
  <pre><code>public class Car&lt;T&gt; {
      Optional&lt;T&gt; studentInGroup;
      public Car()
      {  
      }
  
      public Optional&lt;T&gt; getStudentInGroup() {
          return studentInGroup;
      }
  
      public void setStudentInGroup(T studentInGroup) {
          this.studentInGroup=Optional.of(studentInGroup);
      }
  }
  </code></pre>
  
  <p>and <code>StudentInGroup</code> is like</p>
  
  <pre><code>public class StudentInGroup {
      private String name;
      private boolean isGirl;
      private int age;
  }
  </code></pre>
  
  <p>so, i'd like to build a map based on <code>StudenInGroup</code>'s name field, it the <code>Optional&lt;StudentInGroup&gt;</code> inside the Car is not <code>Optional.empty()</code> while I'd like to substitute it with "none" if in the specific cat the studentIngroup field is equal to <code>Optional.empty()</code>.</p>
  
  <pre><code>Map&lt;String, List&lt;Car&lt;StudentInGroup&gt;&gt;&gt; stringStudentInGroupMap38= studentInGroupStreamSupplier.get().map((StudentInGroup studentInGroup)-&gt;{Car&lt;StudentInGroup&gt; car=new Car&lt;StudentInGroup&gt;();car.setStudentInGroup(studentInGroup);return car;}).collect(Collectors.groupingBy(car-&gt;car.getStudentInGroup().orElseGet(... do something with student there).getName())
  </code></pre>
  
  <p>The possible solution is to create the "none containing StudentInGroup" whose getName will return the desired data, while this doesn't looks like the right approach. however&lt; I haven't found any way to preserve the original <code>Stream&lt;Car&gt;</code> without mapping it to some other Streams and force the grouping on Car.StudentInGroup.Name or "none" if <code>Optional&lt;StudenInGroup&gt;</code> is empty. Any suggestions to code it clear and readable are welcomed!</p>