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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue