mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8274237: Replace 'for' cycles with iterator with enhanced-for in java.base
Reviewed-by: dfuchs, weijun
This commit is contained in:
parent
0c050be64b
commit
baafa6059e
4 changed files with 18 additions and 32 deletions
|
@ -622,8 +622,7 @@ public final class Security {
|
|||
|
||||
// For each selection criterion, remove providers
|
||||
// which don't satisfy the criterion from the candidate set.
|
||||
for (Iterator<String> ite = keySet.iterator(); ite.hasNext(); ) {
|
||||
String key = ite.next();
|
||||
for (String key : keySet) {
|
||||
String value = filter.get(key);
|
||||
|
||||
LinkedHashSet<Provider> newCandidates = getAllQualifyingCandidates(key, value,
|
||||
|
|
|
@ -200,8 +200,8 @@ public class PKIXParameters implements CertPathParameters {
|
|||
throw new InvalidAlgorithmParameterException("the trustAnchors " +
|
||||
"parameter must be non-empty");
|
||||
}
|
||||
for (Iterator<TrustAnchor> i = trustAnchors.iterator(); i.hasNext(); ) {
|
||||
if (!(i.next() instanceof TrustAnchor)) {
|
||||
for (Object trustAnchor : trustAnchors) {
|
||||
if (!(trustAnchor instanceof TrustAnchor)) {
|
||||
throw new ClassCastException("all elements of set must be "
|
||||
+ "of type java.security.cert.TrustAnchor");
|
||||
}
|
||||
|
@ -249,9 +249,8 @@ public class PKIXParameters implements CertPathParameters {
|
|||
*/
|
||||
public void setInitialPolicies(Set<String> initialPolicies) {
|
||||
if (initialPolicies != null) {
|
||||
for (Iterator<String> i = initialPolicies.iterator();
|
||||
i.hasNext();) {
|
||||
if (!(i.next() instanceof String))
|
||||
for (Object initialPolicy : initialPolicies) {
|
||||
if (!(initialPolicy instanceof String))
|
||||
throw new ClassCastException("all elements of set must be "
|
||||
+ "of type java.lang.String");
|
||||
}
|
||||
|
@ -282,8 +281,8 @@ public class PKIXParameters implements CertPathParameters {
|
|||
if (stores == null) {
|
||||
this.certStores = new ArrayList<>();
|
||||
} else {
|
||||
for (Iterator<CertStore> i = stores.iterator(); i.hasNext();) {
|
||||
if (!(i.next() instanceof CertStore)) {
|
||||
for (Object store : stores) {
|
||||
if (!(store instanceof CertStore)) {
|
||||
throw new ClassCastException("all elements of list must be "
|
||||
+ "of type java.security.cert.CertStore");
|
||||
}
|
||||
|
|
|
@ -364,8 +364,7 @@ public class X509CRLSelector implements CRLSelector {
|
|||
private static HashSet<X500Principal> parseIssuerNames(Collection<Object> names)
|
||||
throws IOException {
|
||||
HashSet<X500Principal> x500Principals = new HashSet<>();
|
||||
for (Iterator<Object> t = names.iterator(); t.hasNext(); ) {
|
||||
Object nameObject = t.next();
|
||||
for (Object nameObject : names) {
|
||||
if (nameObject instanceof String) {
|
||||
x500Principals.add(new X500Name((String)nameObject).asX500Principal());
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue