code: @Override
      Collection<X509Certificate> getMatchingCerts(State currentState,
                                                   List<CertStore> certStores)
          throws CertStoreException, CertificateException, IOException
      {
          if (debug != null) {
              debug.println("ForwardBuilder.getMatchingCerts()...");
          }
  
          ForwardState currState = (ForwardState) currentState;
  
          /*
           * We store certs in a Set because we don't want duplicates.
           * As each cert is added, it is sorted based on the PKIXCertComparator
           * algorithm.
           */
          Set<X509Certificate> certs = new TreeSet<>(comparator);
  
          /*
           * Only look for EE certs if search has just started.
           */
          if (currState.isInitial()) {
              getMatchingEECerts(currState, certStores, certs);
          }
          getMatchingCACerts(currState, certStores, certs);
  
          return certs;
      }
docs: Retrieves all certs from the specified CertStores that satisfy the
  requirements specified in the parameters and the current
  PKIX state (name constraints, policy constraints, etc).
  
  @param currentState the current state.
  Must be an instance of <code>ForwardState</code>
  @param certStores list of CertStores