mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8273261: Replace 'while' cycles with iterator with enhanced-for in java.base
Reviewed-by: dfuchs, rriggs, iris, mullan
This commit is contained in:
parent
0aa63feca8
commit
56b8b35286
11 changed files with 43 additions and 92 deletions
|
@ -46,7 +46,6 @@ import java.net.Proxy;
|
|||
import java.net.ProxySelector;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Iterator;
|
||||
import java.security.Permission;
|
||||
import java.util.Properties;
|
||||
import sun.net.NetworkClient;
|
||||
|
@ -250,9 +249,8 @@ public class FtpURLConnection extends URLConnection {
|
|||
} catch (IllegalArgumentException iae) {
|
||||
throw new IOException("Failed to select a proxy", iae);
|
||||
}
|
||||
final Iterator<Proxy> it = proxies.iterator();
|
||||
while (it.hasNext()) {
|
||||
p = it.next();
|
||||
for (Proxy proxy : proxies) {
|
||||
p = proxy;
|
||||
if (p == null || p == Proxy.NO_PROXY ||
|
||||
p.type() == Proxy.Type.SOCKS) {
|
||||
break;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -79,9 +79,8 @@ public class AuthCacheImpl implements AuthCache {
|
|||
// list should contain only one element
|
||||
return (AuthenticationInfo)list.get (0);
|
||||
}
|
||||
ListIterator<AuthCacheValue> iter = list.listIterator();
|
||||
while (iter.hasNext()) {
|
||||
AuthenticationInfo inf = (AuthenticationInfo)iter.next();
|
||||
for (AuthCacheValue authCacheValue : list) {
|
||||
AuthenticationInfo inf = (AuthenticationInfo) authCacheValue;
|
||||
if (skey.startsWith (inf.path)) {
|
||||
return inf;
|
||||
}
|
||||
|
|
|
@ -384,9 +384,7 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
|
|||
}
|
||||
}
|
||||
if (principals != null) {
|
||||
ListIterator<PrincipalEntry> li = principals.listIterator();
|
||||
while (li.hasNext()) {
|
||||
PrincipalEntry pppe = li.next();
|
||||
for (PrincipalEntry pppe : principals) {
|
||||
returnMe = returnMe + ResourcesMgr.getAuthResourceString("NEWLINE") +
|
||||
pppe.getPrincipalClass() + " " +
|
||||
pppe.getPrincipalName();
|
||||
|
|
|
@ -1489,9 +1489,7 @@ public final class Main {
|
|||
info.set(X509CertInfo.SUBJECT,
|
||||
dname==null?req.getSubjectName():new X500Name(dname));
|
||||
CertificateExtensions reqex = null;
|
||||
Iterator<PKCS10Attribute> attrs = req.getAttributes().getAttributes().iterator();
|
||||
while (attrs.hasNext()) {
|
||||
PKCS10Attribute attr = attrs.next();
|
||||
for (PKCS10Attribute attr : req.getAttributes().getAttributes()) {
|
||||
if (attr.getAttributeId().equals(PKCS9Attribute.EXTENSION_REQUEST_OID)) {
|
||||
reqex = (CertificateExtensions)attr.getAttributeValue();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -29,7 +29,6 @@ import java.io.IOException;
|
|||
import java.security.cert.PolicyQualifierInfo;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -201,9 +200,7 @@ public class PolicyInformation {
|
|||
"PolicyQualifierInfo can be set.");
|
||||
}
|
||||
if (obj instanceof Set) {
|
||||
Iterator<?> i = ((Set<?>)obj).iterator();
|
||||
while (i.hasNext()) {
|
||||
Object obj1 = i.next();
|
||||
for (Object obj1 : (Set<?>) obj) {
|
||||
if (!(obj1 instanceof PolicyQualifierInfo)) {
|
||||
throw new IOException("Attribute value must be a" +
|
||||
"Set of PolicyQualifierInfo objects.");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue