@Override
    public List<? extends Serializable> query(final TicketRegistryQueryCriteria criteria) {
        return getMapInstance()
            .values()
            .parallelStream()
            .filter(ticket -> criteria.getType().equals(ticket.getPrefix())
                && (StringUtils.isBlank(criteria.getId()) || digestIdentifier(criteria.getId()).equals(ticket.getId())))
            .map(ticket -> criteria.isDecode() ? decodeTicket(ticket) : ticket)
            .filter(ticket -> StringUtils.isBlank(criteria.getPrincipal())
                || (ticket instanceof final AuthenticationAwareTicket aat
                    && StringUtils.equalsIgnoreCase(criteria.getPrincipal(), aat.getAuthentication().getPrincipal().getId())))
            .limit(criteria.getCount() > 0 ? criteria.getCount() : Long.MAX_VALUE)
            .collect(Collectors.toList());
    }
This is {@link AbstractMapBasedTicketRegistry}.

@author Misagh Moayyed
@since 5.2.0
core/cas-server-core-tickets-api/src/main/java/org/apereo/cas/ticket/registry/AbstractMapBasedTicketRegistry.java