public static <T> Collection<T> checkCollectionNotEmpty(final Collection<T> value,
                                                            final String valueName) {
        if (value == null) {
            throw new NullPointerException(valueName + " must not be null");
        }
        if (value.isEmpty()) {
            throw new IllegalArgumentException(valueName + " is empty");
        }
        return value;
    }
Ensures that the {@link Collection} is not {@code null}, and contains at least one element.

@param value     a {@link Collection} of boxed elements.
@param valueName the name of the argument to use if the check fails.
@return the validated {@link Collection}
@throws NullPointerException     if the {@code value} was {@code null}
@throws IllegalArgumentException if the {@code value} was empty
android/android_framework/base/src/main/java/util/PreconditionUtils.java