private void indexCertificate(X509Certificate cert){
  X500Principal subject=cert.getSubjectX500Principal();
  Object oldEntry=certSubjects.put(subject,cert);
  if (oldEntry != null) {
    if (oldEntry instanceof X509Certificate) {
      if (cert.equals(oldEntry)) {
        return;
      }
      List<X509Certificate> list=new ArrayList<>(2);
      list.add(cert);
      list.add((X509Certificate)oldEntry);
      certSubjects.put(subject,list);
    }
 else {
      @SuppressWarnings("unchecked") List<X509Certificate> list=(List<X509Certificate>)oldEntry;
      if (list.contains(cert) == false) {
        list.add(cert);
      }
      certSubjects.put(subject,list);
    }
  }
}

private void indexCertificate ( X509Certificate cert ) { X500Principal subject = cert . getSubjectX500Principal ( ) ; Object oldEntry = certSubjects . put ( subject , cert ) ; if ( oldEntry != null ) { if ( oldEntry instanceof X509Certificate ) { if ( cert . equals ( oldEntry ) ) { return ; } List < X509Certificate > list = new ArrayList < > ( 2 ) ; list . add ( cert ) ; list . add ( ( X509Certificate ) oldEntry ) ; certSubjects . put ( subject , list ) ; } else { @ SuppressWarnings ( "unchecked" ) List < X509Certificate > list = ( List < X509Certificate > ) oldEntry ; if ( list . contains ( cert ) == false ) { list . add ( cert ) ; } certSubjects . put ( subject , list ) ; } } }
add an x509certificate to the index .
