title: Processing elements after filter has removed all elements
body: <p>I have the problem where I filter some elements of the stream and filter can remove some or all elements. How do I handle situation when no elements are left after filtering?</p>
  <p>I tried to check if any elements are left using <code>Optional&lt;T&gt;</code>, which was a logical thing to do, but even here I get a <code>NullPointerException</code>. Here is an example:</p>
  <pre><code>Optional&lt;T&gt; elem = details.stream()
                  .filter(T::test)
                  .findFirst(); //&lt;=============== NPE
  
  if(elem.isPreset){...}
  </code></pre>
  <p>How can this be handeled?</p>