@Override
    @CanIgnoreReturnValue
    public boolean hasAttribute(final String name, final Predicate<Object> predicate) {
        if (this.attributes.containsKey(name)) {
            val value = this.attributes.get(name);
            val valueCol = CollectionUtils.toCollection(value);
            return valueCol.stream().anyMatch(predicate);
        }
        return false;
    }
Factory method.

@param applicationContext  the application context
@param principal           principal.
@param principalFactory    principalFactory.
@param principalAttributes principalAttributes.
@param service             service.
@param registeredService   registeredService.
@param authentication      authentication.
@return AuthenticationBuilder new AuthenticationBuilder instance.
@throws Throwable the throwable
core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/DefaultAuthenticationBuilder.java