@Override
    public boolean exists(final PasswordChangeRequest changeRequest) {
        val username = changeRequest.getUsername();
        val password = changeRequest.toPassword();
        val encodedPassword = encodePassword(password);
        return history
            .stream()
            .anyMatch(p -> p.getPassword().equalsIgnoreCase(encodedPassword) && p.getUsername().equalsIgnoreCase(username));
    }
This is {@link InMemoryPasswordHistoryService}.

@author Misagh Moayyed
@since 6.1.0
support/cas-server-support-pm-core/src/main/java/org/apereo/cas/pm/impl/history/InMemoryPasswordHistoryService.java