public static @NonNull
    <C extends Collection<T>, T> C checkCollectionElementsNotNull(
            final C value, final String valueName) {
        if (value == null) {
            throw new NullPointerException(valueName + " must not be null");
        }

        long ctr = 0;
        for (T elem : value) {
            if (elem == null) {
                throw new NullPointerException(
                        String.format("%s[%d] must not be null", valueName, ctr));
            }
            ++ctr;
        }

        return value;
    }
Ensures that the {@link Collection} is not {@code null}, and none of its elements are
{@code null}.

@param value     a {@link Collection} of boxed objects
@param valueName the name of the argument to use if the check fails
@return the validated {@link Collection}
@throws NullPointerException if the {@code value} or any of its elements were {@code null}
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/util/Preconditions.java