Filter Null items in Stream
<p>When using a Java Stream, sometimes null values can occur after mapping. Currently when these values need to be omitted, I use:</p>

<pre><code>.stream()
.&lt;other operations...&gt;
.filter(element -&gt; element != null)
.&lt;other operations...&gt;
</code></pre>

<p>For a more functional style a tiny helper method is quickly written:</p>

<pre><code>public static &lt;T&gt; boolean nonNull(T entity) {
    return entity != null;
}
</code></pre>

<p>So that you can use a method reference instead:</p>

<pre><code>.stream()
.&lt;other operations...&gt;
.filter(Elements::nonNull)
.&lt;other operations...&gt;
</code></pre>

<p>I could not find such a jdk method, even though I would suspect they have included one. Is there a different approach here? Or did they omit this for a reason?</p>