Eliran Bivas opened SPR-7925 and commented

It's possible to add the following code to Assert utility class

public static void noNullElements(final Collection<?> collection, final String message) {
    for (Object object : collection) {
        if (object == null) {
            throw new IllegalArgumentException(message);
        }
    }
}

public static void noNullElements(Collection<?> collection) {
    noNullElements(collection, "[Assertion failed] - this collection must not contain any null elements");
}

Affects: 3.0.5

Comment From: spring-projects-issues

Eliran Bivas commented

It's also possible to add:

public static void noNullKeys(final Map<?, ?> map) {
    noNullElements(map.keySet());
}

public static void noNullValues(final Map<?, ?> map) {
    noNullElements(map.values());
}

Comment From: spring-projects-issues

Roland Weisleder commented

PR created: https://github.com/spring-projects/spring-framework/pull/1565

Comment From: rweisleder

Commit https://github.com/spring-projects/spring-framework/commit/4000b244ff7b1db1f4eba9c4dbf2fc97162da254 added Assert.noNullElements(...) for collections.

Comment From: sbrannen

Superseded by work performed in conjunction with #23151.

See 4000b244ff7b1db1f4eba9c4dbf2fc97162da254.