title: NullPointerException: element cannot be mapped to a null key
body: <p>I have read the topic:</p>
  
  <p><a href="https://stackoverflow.com/questions/22625065/collectors-groupingby-doesnt-accept-null-keys">Collectors.groupingBy doesn't accept null keys</a></p>
  
  <p>But I don't understand how can I apply it for my issue:</p>
  
  <p>my code:  </p>
  
  <pre><code>Map&lt;String, List&lt;MappingEntry&gt;&gt; mappingEntryMap = mapping.getMappingEntries()
                  .stream()
                  .collect(Collectors.groupingBy(MappingEntry::getMilestone, Collectors.mapping(e -&gt; e, Collectors.toList())));
  </code></pre>
  
  <p>For me <code>MappingEntry::getMilestone</code> sometimes can return null. It is ok for my situation but I see:</p>
  
  <pre><code>Caused by: java.lang.NullPointerException: element cannot be mapped to a null key
      at java.util.Objects.requireNonNull(Objects.java:228)
      at java.util.stream.Collectors.lambda$groupingBy$45(Collectors.java:907)
      at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
      at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
      at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
      at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
      at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
      at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
  </code></pre>
  
  <p>How can I avoid this exception?  </p>