Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Collection; import java.util.Objects; import java.util.stream.Stream; public class Main { /** @see #isAnyNull(Collection) */ public static boolean isAnyNull(Object... items) { return Stream.of(items).anyMatch(Objects::isNull); } /** * Returns true if any element of {@code items} is null. * @throws NullPointerException if {@code items} itself is null. */ public static boolean isAnyNull(Collection<?> items) { return items.stream().anyMatch(Objects::isNull); } }