public static void allElementsOfType(Collection collection, Class clazz, String message) { Validate.notNull(collection); Validate.notNull(clazz); for (Iterator it = collection.iterator(); it.hasNext(); ) { if (clazz.isInstance(it.next()) == false) { throw new IllegalArgumentException(message); } } }
public static void allElementsOfType(Collection collection, Class clazz) { Validate.notNull(collection); Validate.notNull(clazz); int i = 0; for (Iterator it = collection.iterator(); it.hasNext(); i++) { if (clazz.isInstance(it.next()) == false) { throw new IllegalArgumentException( "The validated collection contains an element not of type " + clazz.getName() + " at index: " + i); } } }
public static void noNullElements(Object[] array, String message) { Validate.notNull(array); for (Object array1 : array) { if (array1 == null) { throw new IllegalArgumentException(message); } } }
public static void noNullElements(Collection collection, String message) { Validate.notNull(collection); for (Iterator it = collection.iterator(); it.hasNext(); ) { if (it.next() == null) { throw new IllegalArgumentException(message); } } }
public static void noNullElements(Object[] array) { Validate.notNull(array); for (int i = 0; i < array.length; i++) { if (array[i] == null) { throw new IllegalArgumentException( "The validated array contains null element at index: " + i); } } }
public static void noNullElements(Collection collection) { Validate.notNull(collection); int i = 0; for (Iterator it = collection.iterator(); it.hasNext(); i++) { if (it.next() == null) { throw new IllegalArgumentException( "The validated collection contains null element at index: " + i); } } }
public static void notNull(Object object) { notNull(object, "The validated object is null"); }