@Override
    public Optional<RegisteredService> findServiceBy(final long id) {
        return isEnabled()
            ? indexedRegisteredServices.stream().filter(registeredService -> registeredService.getId() == id).findFirst()
            : Optional.empty();
    }
This is {@link DefaultRegisteredServiceIndexService}.

@author Misagh Moayyed
@since 7.3.0
core/cas-server-core-services-registry/src/main/java/org/apereo/cas/services/query/DefaultRegisteredServiceIndexService.java