title: How to return false if collection is null before stream in java 8?
body: <p>I wrote bellow code to check some condition.</p>
  
  <pre><code>/**
   * Returns true if any of the dose detail is an x
   * @return boolean
   */
  public &lt;DD extends BD&lt;DI&gt;, DI extends BI&gt; boolean Y(final Collection&lt;DD&gt; dds) {
      return dds.stream().anyMatch(dd -&gt; dd.M().K());
  }
  </code></pre>
  
  <p>but this method have some risk dds , come as null. I need to return false is dd also null. how can be modify this method using java 8 to null safe ? </p>