public static void requireNotMultiValued(final Set<String> parametersToCheck, final Map parameterMap) {

        for (val parameterName : parametersToCheck) {
            if (parameterMap.containsKey(parameterName)) {
                val values = (String[]) parameterMap.get(parameterName);
                if (values.length > 1) {
                    throwException(new IllegalStateException("Parameter [" + parameterName + "] had multiple values ["
                                                           + Arrays.toString(values) + "] but at most one value is allowable."));
                }
            }
        }

    }
For each parameter to check, verify that it has zero or one value.
<p>
The Set of parameters to check MAY be empty.
The parameter map MAY NOT contain any given parameter to check.
<p>
This method is an implementation detail and is not exposed API.
This method is only non-private to allow JUnit testing.

@param parametersToCheck non-null potentially empty Set of String names of parameters
@param parameterMap      non-null Map from String name of parameter to String[] values
@throws IllegalStateException if a parameterToCheck is present in the parameterMap with multiple values.
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/filters/RequestParameterPolicyEnforcementFilter.java