Here you can find the source of assertNotNullOrThrowException(final Object... objects)
Parameter | Description |
---|---|
objects | - The list of objects to check. |
Parameter | Description |
---|---|
IllegalArgumentException | If at least one of the specified objectsis <tt>null</tt>. |
public static void assertNotNullOrThrowException(final Object... objects) throws IllegalArgumentException
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w. ja v a 2s . com*/ * @param objects - The list of objects to check. * @throws IllegalArgumentException If at least one of the specified objects * is <tt>null</tt>. * @see #assertNotNull(Object...) * @throws IllegalArgumentException If at least one of the specified objects * is <tt>null</tt>. */ public static void assertNotNullOrThrowException(final Object... objects) throws IllegalArgumentException { if (!assertNotNull(objects)) throw new IllegalArgumentException("Cannot be null !"); } /** * @param objects - The list of objects to check. * @return <code>true</code> if none of the objects is <code>null</code>, * <code>false</code> otherwise. */ public static boolean assertNotNull(final Object... objects) { for (Object obj : objects) { if (obj == null) { return false; } } return true; } }