@Override
    public long size() {
        val response = getSearchResultResponse();
        if (LdapUtils.containsResultEntry(response)) {
            return response.getEntries()
                .stream()
                .map(this.ldapServiceMapper::mapToRegisteredService)
                .filter(Objects::nonNull)
                .count();
        }
        return 0;
    }
{@inheritDoc}
This may be an expensive operation.
In order to count the number of available definitions in LDAP,
this call will attempt to execute a search query to load services
and the results will be counted. Do NOT attempt to call this
operation in a loop.

@return number of entries in the service registry
support/cas-server-support-ldap-service-registry/src/main/java/org/apereo/cas/adaptors/ldap/services/LdapServiceRegistry.java