title: Java filter NullPointer
body: <p>Trying to create filter, need to choose records which type is not equals &quot;N&quot;. I trying do it by this way, but I getting NullPointer. I think this is because in my database <code>Type</code> sometimes is null. How can I fix this filter to not get NullPointer?</p>
  <pre><code>Collection&lt;Plan&gt; plan = packet.getPlan().stream() //    
              .filter(item -&gt; !item.getType().equals(&quot;N&quot;)) //
              .map(packetPlan -&gt; Plan.newInstance( //
                      packetPlan, //
                      activePlan.contains(packetPlan.getType()))) //
              .collect(Collectors.toList());
  </code></pre>