title: Why does Map.getOrDefault() warn about a NullPointerException?
body: <p>I have a Map (a multi-map, of sorts) with the following signature:</p>
  
  <pre><code>Map&lt;String, Set&lt;String&gt;&gt; motherChildIndex;
  </code></pre>
  
  <p>If the key doesn't exist in the map, I would prefer that it return an empty set (as opposed to null), so I stumbled upon the <code>getOrDefault</code> method, which should allow me to "ignore" nulls, effectively.</p>
  
  <p>Here is my relevant code:</p>
  
  <pre><code>motherChildIndex
          .getOrDefault(personId, Collections.emptySet()) //personId is just a string that may or may not be in the map, hence getOrDefault
          .stream() //I get the warning here
          .map(personsIndex::get) //Not important to reproduce
          .forEach(children::add); //Not important to reproduce
  </code></pre>
  
  <p>On the <code>.stream()</code> line, I get a warning:</p>
  
  <blockquote>
    <p>Method invocation 'stream' may produce 'java.lang.NullPointerException'</p>
  </blockquote>
  
  <p>Why? I thought <code>getOrDefault()</code> was supposed to never return a null.</p>
  
  <p>I'm using Android Studio as my IDE, if that makes any difference.</p>