I wrote bellow code to check some condition.
/**
* Returns true if any of the dose detail is an x
* @return boolean
*/
public <DD extends BD<DI>, DI extends BI> boolean Y(final Collection<DD> dds) {
return dds.stream().anyMatch(dd -> dd.M().K());
}
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 ?