title: How to skip stream filter if filtered value is null?
body: <p>I have a list of Java objects. In database some of objects has got field <code>nextSyncDate</code> and some not. What I want to do is to <strong>put filter</strong> on java stream but <strong>only if</strong> this field exists and is for example greater than today date. So simplify, I want to get objects which <code>nextSyncDate</code> is greater than today and objects which hasn't got this field (getting NullPointException after <code>get()</code> on this field).</p>
  
  <p>I have tried something like this but it's not working like I want to..</p>
  
  <pre class="lang-java prettyprint-override"><code>List&lt;MyObjects&gt; objects;
  objects.stream()
      .filter(obj -&gt; Objects.nonNull(obj.getNextSyncDate()) &amp;&amp; obj.getNextSyncDate().before(new Date()))
  </code></pre>
  
  <p>On the other hand, all objects has got field <code>counter</code>. What I want to do additionally is to set <code>nextSyncDate</code> (for example for tomorrow) for every object which <code>counter</code> is greater than 15. I tried to <code>.map()</code> objects before <code>.filter()</code> but it's also not working.</p>