< prev index next >
src/java.base/share/classes/java/security/cert/X509CertSelector.java
Print this page
@@ -617,12 +617,12 @@
if ((keyPurposeSet == null) || keyPurposeSet.isEmpty()) {
this.keyPurposeSet = null;
keyPurposeOIDSet = null;
} else {
this.keyPurposeSet =
- Collections.unmodifiableSet(new HashSet<String>(keyPurposeSet));
- keyPurposeOIDSet = new HashSet<ObjectIdentifier>();
+ Collections.unmodifiableSet(new HashSet<>(keyPurposeSet));
+ keyPurposeOIDSet = new HashSet<>();
for (String s : this.keyPurposeSet) {
keyPurposeOIDSet.add(new ObjectIdentifier(s));
}
}
}
@@ -813,16 +813,16 @@
private void addSubjectAlternativeNameInternal(int type, Object name)
throws IOException {
// First, ensure that the name parses
GeneralNameInterface tempName = makeGeneralNameInterface(type, name);
if (subjectAlternativeNames == null) {
- subjectAlternativeNames = new HashSet<List<?>>();
+ subjectAlternativeNames = new HashSet<>();
}
if (subjectAlternativeGeneralNames == null) {
- subjectAlternativeGeneralNames = new HashSet<GeneralNameInterface>();
+ subjectAlternativeGeneralNames = new HashSet<>();
}
- List<Object> list = new ArrayList<Object>(2);
+ List<Object> list = new ArrayList<>(2);
list.add(Integer.valueOf(type));
list.add(name);
subjectAlternativeNames.add(list);
subjectAlternativeGeneralNames.add(tempName);
}
@@ -843,11 +843,11 @@
* not an acceptable value.
* @return a Set of {@code GeneralNameInterface}s
* @throws IOException if a parsing error occurs
*/
private static Set<GeneralNameInterface> parseNames(Collection<List<?>> names) throws IOException {
- Set<GeneralNameInterface> genNames = new HashSet<GeneralNameInterface>();
+ Set<GeneralNameInterface> genNames = new HashSet<>();
for (List<?> nameList : names) {
if (nameList.size() != 2) {
throw new IOException("name list size not 2");
}
Object o = nameList.get(0);
@@ -1094,14 +1094,14 @@
policySet = null;
policy = null;
} else {
// Snapshot set and parse it
Set<String> tempSet = Collections.unmodifiableSet
- (new HashSet<String>(certPolicySet));
+ (new HashSet<>(certPolicySet));
/* Convert to Vector of ObjectIdentifiers */
Iterator<String> i = tempSet.iterator();
- Vector<CertificatePolicyId> polIdVector = new Vector<CertificatePolicyId>();
+ Vector<CertificatePolicyId> polIdVector = new Vector<>();
while (i.hasNext()) {
Object o = i.next();
if (!(o instanceof String)) {
throw new IOException("non String in certPolicySet");
}
@@ -1265,14 +1265,14 @@
private void addPathToNameInternal(int type, Object name)
throws IOException {
// First, ensure that the name parses
GeneralNameInterface tempName = makeGeneralNameInterface(type, name);
if (pathToGeneralNames == null) {
- pathToNames = new HashSet<List<?>>();
- pathToGeneralNames = new HashSet<GeneralNameInterface>();
+ pathToNames = new HashSet<>();
+ pathToGeneralNames = new HashSet<>();
}
- List<Object> list = new ArrayList<Object>(2);
+ List<Object> list = new ArrayList<>(2);
list.add(Integer.valueOf(type));
list.add(name);
pathToNames.add(list);
pathToGeneralNames.add(tempName);
}
@@ -1669,14 +1669,14 @@
* @return a deep copy of the specified {@code Collection}
* @throws IOException if a parsing error occurs
*/
private static Set<List<?>> cloneAndCheckNames(Collection<List<?>> names) throws IOException {
// Copy the Lists and Collection
- Set<List<?>> namesCopy = new HashSet<List<?>>();
+ Set<List<?>> namesCopy = new HashSet<>();
for (List<?> o : names)
{
- namesCopy.add(new ArrayList<Object>(o));
+ namesCopy.add(new ArrayList<>(o));
}
// Check the contents of the Lists and clone any byte arrays
for (List<?> list : namesCopy) {
@SuppressWarnings("unchecked") // See javadoc for parameter "names".
@@ -2395,11 +2395,11 @@
List<PolicyInformation> policies = ext.get(CertificatePoliciesExtension.POLICIES);
/*
* Convert the Vector of PolicyInformation to a Vector
* of CertificatePolicyIds for easier comparison.
*/
- List<CertificatePolicyId> policyIDs = new ArrayList<CertificatePolicyId>(policies.size());
+ List<CertificatePolicyId> policyIDs = new ArrayList<>(policies.size());
for (PolicyInformation info : policies) {
policyIDs.add(info.getPolicyIdentifier());
}
if (policy != null) {
boolean foundOne = false;
< prev index next >