mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +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
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue