private static void throwExceptionForBeingEmpty() { throwExceptionForBeingEmpty(ARGUMENT_EMPTY); }
private static void throwExceptionForBeingEmpty() { throwExceptionForBeingEmpty(ARGUMENT_EMPTY); }
/** * Verifies that the given {@code CharSequence} is not {@code null} or empty. * * @param s the given {@code CharSequence}. * @param message error message in case of empty {@code String}. * @return the validated {@code CharSequence}. * @throws NullPointerException if the given {@code CharSequence} is {@code null}. * @throws IllegalArgumentException if the given {@code CharSequence} is empty. */ public static CharSequence checkNotNullOrEmpty(CharSequence s, String message) { checkNotNull(s, message); if (s.length() == 0) throwExceptionForBeingEmpty(message); return s; }
/** * Verifies that the given array is not {@code null} or empty. * * @param <T> the type of elements of the array. * @param array the given array. * @return the validated array. * @throws NullPointerException if the given array is {@code null}. * @throws IllegalArgumentException if the given array is empty. */ public static <T> T[] checkNotNullOrEmpty(T[] array) { T[] checked = checkNotNull(array); if (checked.length == 0) throwExceptionForBeingEmpty(); return checked; }
/** * Verifies that the given {@code CharSequence} is not {@code null} or empty. * * @param s the given {@code CharSequence}. * @param message error message in case of empty {@code String}. * @return the validated {@code CharSequence}. * @throws NullPointerException if the given {@code CharSequence} is {@code null}. * @throws IllegalArgumentException if the given {@code CharSequence} is empty. */ public static CharSequence checkNotNullOrEmpty(CharSequence s, String message) { checkNotNull(s, message); if (s.length() == 0) throwExceptionForBeingEmpty(message); return s; }
/** * Verifies that the given array is not {@code null} or empty. * * @param <T> the type of elements of the array. * @param array the given array. * @return the validated array. * @throws NullPointerException if the given array is {@code null}. * @throws IllegalArgumentException if the given array is empty. */ public static <T> T[] checkNotNullOrEmpty(T[] array) { T[] checked = checkNotNull(array); if (checked.length == 0) throwExceptionForBeingEmpty(); return checked; }
private static void throwExceptionForBeingEmpty() { throwExceptionForBeingEmpty(ARGUMENT_EMPTY); }
/** * Verifies that the given array is not {@code null} or empty. * * @param array the given array. * @return the validated array. * @throws NullPointerException if the given array is {@code null}. * @throws IllegalArgumentException if the given array is empty. */ public static <T> T[] checkNotNullOrEmpty(T[] array) { T[] checked = checkNotNull(array); if (checked.length == 0) { throwExceptionForBeingEmpty(); } return checked; }
/** * Verifies that the given {@code String} is not {@code null} or empty. * * @param s the given {@code String}. * @param message error message in case of empty {@code String}. * @return the validated {@code String}. * @throws NullPointerException if the given {@code String} is {@code null}. * @throws IllegalArgumentException if the given {@code String} is empty. */ public static String checkNotNullOrEmpty(String s, String message) { checkNotNull(s, message); if (s.isEmpty()) { throwExceptionForBeingEmpty(message); } return s; }