private void matchX509Certs ( CertSelector selector , Collection < Certificate > matches ) { for ( Object obj : certSubjects . values ( ) ) { if ( obj instanceof X509Certificate ) { X509Certificate cert = ( X509Certificate ) obj ; if ( selector . match ( cert ) ) { matches . add ( cert ) ; } } else { // See certSubjects javadoc. @ SuppressWarnings ( "unchecked" ) List < X509Certificate > list = ( List < X509Certificate > ) obj ; for ( X509Certificate cert : list ) { if ( selector . match ( cert ) ) { matches . add ( cert ) ; } } } } }
Iterate through all the X509Certificates and add matches to the collection .