Use enhanced for loop where feasible

See gh-31916
This commit is contained in:
Yanming Zhou
2023-12-28 15:15:07 +08:00
committed by Stéphane Nicoll
parent ed1bfb8177
commit 4a450c6fab
6 changed files with 10 additions and 17 deletions

View File

@@ -24,7 +24,6 @@ import java.rmi.MarshalException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -1224,8 +1223,7 @@ public abstract class AbstractAopProxyTests {
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
ReflectiveMethodInvocation rmi = (ReflectiveMethodInvocation) invocation;
for (Iterator<String> it = rmi.getUserAttributes().keySet().iterator(); it.hasNext(); ){
Object key = it.next();
for (Object key : rmi.getUserAttributes().keySet()) {
assertThat(rmi.getUserAttributes().get(key)).isEqualTo(expectedValues.get(key));
}
rmi.getUserAttributes().putAll(valuesToAdd);

View File

@@ -186,8 +186,8 @@ class CommonsPool2TargetSourceTests {
pooledInstances[9] = targetSource.getTarget();
// release all objects
for (int i = 0; i < pooledInstances.length; i++) {
targetSource.releaseTarget(pooledInstances[i]);
for (Object pooledInstance : pooledInstances) {
targetSource.releaseTarget(pooledInstance);
}
}