mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8284780: Need methods to create pre-sized HashSet and LinkedHashSet
Reviewed-by: naoto, bpb, dfuchs, ascarpino
This commit is contained in:
parent
a941bc2de6
commit
e01cd7c3ed
29 changed files with 147 additions and 47 deletions
|
@ -514,7 +514,7 @@ public class PKCS7 {
|
|||
// CRLs (optional)
|
||||
if (crls != null && crls.length != 0) {
|
||||
// cast to X509CRLImpl[] since X509CRLImpl implements DerEncoder
|
||||
Set<X509CRLImpl> implCRLs = new HashSet<>(crls.length);
|
||||
Set<X509CRLImpl> implCRLs = HashSet.newHashSet(crls.length);
|
||||
for (X509CRL crl: crls) {
|
||||
if (crl instanceof X509CRLImpl)
|
||||
implCRLs.add((X509CRLImpl) crl);
|
||||
|
|
|
@ -92,7 +92,7 @@ class ConstraintsChecker extends PKIXCertPathChecker {
|
|||
@Override
|
||||
public Set<String> getSupportedExtensions() {
|
||||
if (supportedExts == null) {
|
||||
supportedExts = new HashSet<String>(2);
|
||||
supportedExts = HashSet.newHashSet(2);
|
||||
supportedExts.add(BasicConstraints_Id.toString());
|
||||
supportedExts.add(NameConstraints_Id.toString());
|
||||
supportedExts = Collections.unmodifiableSet(supportedExts);
|
||||
|
|
|
@ -81,8 +81,8 @@ final class ForwardBuilder extends Builder {
|
|||
|
||||
// populate sets of trusted certificates and subject DNs
|
||||
trustAnchors = buildParams.trustAnchors();
|
||||
trustedCerts = new HashSet<X509Certificate>(trustAnchors.size());
|
||||
trustedSubjectDNs = new HashSet<X500Principal>(trustAnchors.size());
|
||||
trustedCerts = HashSet.newHashSet(trustAnchors.size());
|
||||
trustedSubjectDNs = HashSet.newHashSet(trustAnchors.size());
|
||||
for (TrustAnchor anchor : trustAnchors) {
|
||||
X509Certificate trustedCert = anchor.getTrustedCert();
|
||||
if (trustedCert != null) {
|
||||
|
|
|
@ -85,7 +85,7 @@ class KeyChecker extends PKIXCertPathChecker {
|
|||
@Override
|
||||
public Set<String> getSupportedExtensions() {
|
||||
if (supportedExts == null) {
|
||||
supportedExts = new HashSet<String>(3);
|
||||
supportedExts = HashSet.newHashSet(3);
|
||||
supportedExts.add(KeyUsage_Id.toString());
|
||||
supportedExts.add(ExtendedKeyUsage_Id.toString());
|
||||
supportedExts.add(SubjectAlternativeName_Id.toString());
|
||||
|
|
|
@ -93,7 +93,7 @@ class PolicyChecker extends PKIXCertPathChecker {
|
|||
if (initialPolicies.isEmpty()) {
|
||||
// if no initialPolicies are specified by user, set
|
||||
// initPolicies to be anyPolicy by default
|
||||
this.initPolicies = new HashSet<String>(1);
|
||||
this.initPolicies = HashSet.newHashSet(1);
|
||||
this.initPolicies.add(ANY_POLICY);
|
||||
} else {
|
||||
this.initPolicies = new HashSet<String>(initialPolicies);
|
||||
|
@ -154,7 +154,7 @@ class PolicyChecker extends PKIXCertPathChecker {
|
|||
@Override
|
||||
public Set<String> getSupportedExtensions() {
|
||||
if (supportedExts == null) {
|
||||
supportedExts = new HashSet<String>(4);
|
||||
supportedExts = HashSet.newHashSet(4);
|
||||
supportedExts.add(CertificatePolicies_Id.toString());
|
||||
supportedExts.add(PolicyMappings_Id.toString());
|
||||
supportedExts.add(PolicyConstraints_Id.toString());
|
||||
|
|
|
@ -573,7 +573,7 @@ final class CertificateMessage {
|
|||
if ((subAltDnsName != null) && !subAltDnsName.isEmpty()) {
|
||||
if (subAltDnsNames == null) {
|
||||
subAltDnsNames =
|
||||
new HashSet<>(subjectAltNames.size());
|
||||
HashSet.newHashSet(subjectAltNames.size());
|
||||
}
|
||||
subAltDnsNames.add(subAltDnsName);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ final class SunX509KeyManagerImpl extends X509ExtendedKeyManager {
|
|||
// assert privateKey and certificates != null
|
||||
this.privateKey = privateKey;
|
||||
this.certificates = certificates;
|
||||
this.issuerX500Principals = new HashSet<>(certificates.length);
|
||||
this.issuerX500Principals = HashSet.newHashSet(certificates.length);
|
||||
for (X509Certificate certificate : certificates) {
|
||||
issuerX500Principals.add(certificate.getIssuerX500Principal());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue