title: How can I negate a lambda Predicate?
body: <p>Lets say I have a Stream of Strings.</p>
  
  <pre class="lang-java prettyprint-override"><code>final Stream&lt;String&gt; stream = ...;
  </code></pre>
  
  <p>I want to filter out each empty string after trimmed.</p>
  
  <pre><code>stream
      .filter(Objects::nonNull)
      .map(String::trim)
      .filter(v -&gt; !v.isEmpty());
  </code></pre>
  
  <p>Is there any way to apply <a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/Predicate.html#negate--">Predicate#negate()</a> for replacing <code>v -&gt; !v.isEmpty()</code> part?</p>
  
  <pre class="lang-java prettyprint-override"><code>.filter(((Predicate) String::isEmpty).negate()) // not compile
  </code></pre>