@Override
    public long countTicketsFor(final Service service) {
        return stream()
            .map(this::decodeTicket)
            .filter(ServiceAwareTicket.class::isInstance)
            .filter(ticket -> !ticket.isExpired())
            .map(ServiceAwareTicket.class::cast)
            .filter(ticket -> Objects.nonNull(ticket.getService()))
            .filter(ticket -> ticket.getService().getId().equals(service.getId()))
            .count();
    }
Base ticket registry class that implements common ticket-related ops.

@author Scott Battaglia
@since 3.0.0
core/cas-server-core-tickets-api/src/main/java/org/apereo/cas/ticket/registry/AbstractTicketRegistry.java