Author: britter
Date: Tue Nov  3 21:07:32 2015
New Revision: 1712414

URL: http://svn.apache.org/viewvc?rev=1712414&view=rev
Log:
For loop can be replaced with foreach

Modified:
    
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/AccessibleObjectsRegistry.java
    
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertyDescriptor.java
    
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/DescribeTestCase.java

Modified: 
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/AccessibleObjectsRegistry.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/AccessibleObjectsRegistry.java?rev=1712414&r1=1712413&r2=1712414&view=diff
==============================================================================
--- 
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/AccessibleObjectsRegistry.java
 (original)
+++ 
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/AccessibleObjectsRegistry.java
 Tue Nov  3 21:07:32 2015
@@ -162,17 +162,17 @@ abstract class AccessibleObjectsRegistry
             AO[] accessibleObjectsArray = getAccessibleObjectsArray(type);
             float bestMatchCost = Float.MAX_VALUE;
             float myCost = Float.MAX_VALUE;
-            for (int i = 0, size = accessibleObjectsArray.length; i < size; 
i++) {
-                if (matches(accessibleObjectsArray[i], name)) {
+            for (AO anAccessibleObjectsArray : accessibleObjectsArray) {
+                if (matches(anAccessibleObjectsArray, name)) {
                     // compare parameters
-                    Class<?>[] methodsParams = 
getParameterTypes(accessibleObjectsArray[i]);
+                    Class<?>[] methodsParams = 
getParameterTypes(anAccessibleObjectsArray);
                     int methodParamSize = methodsParams.length;
                     if (methodParamSize == paramSize) {
                         boolean match = checkTypesCompatible(methodsParams, 
parameterTypes);
 
                         if (match) {
                             // get accessible version of method
-                            AO current = resolveAccessible(type, 
accessibleObjectsArray[i]);
+                            AO current = resolveAccessible(type, 
anAccessibleObjectsArray);
                             if (current != null) {
                                 // determine which method the compiler would 
chose
                                 myCost = 
getTotalTransformationCost(parameterTypes, getParameterTypes(current));

Modified: 
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertyDescriptor.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertyDescriptor.java?rev=1712414&r1=1712413&r2=1712414&view=diff
==============================================================================
--- 
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertyDescriptor.java
 (original)
+++ 
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/MappedPropertyDescriptor.java
 Tue Nov  3 21:07:32 2015
@@ -211,8 +211,7 @@ public class MappedPropertyDescriptor
         // So we start with the given class and walk up the superclass chain.
         for (Class<?> clazz = initial; clazz != null; clazz = 
clazz.getSuperclass()) {
             Method[] methods = clazz.getDeclaredMethods();
-            for (int i = 0; i < methods.length; i++) {
-                Method method = methods[i];
+            for (Method method : methods) {
                 if (method == null) {
                     continue;
                 }
@@ -231,8 +230,8 @@ public class MappedPropertyDescriptor
         // the argument class is itself an interface, and when the argument
         // class is an abstract class.
         Class<?>[] interfaces = initial.getInterfaces();
-        for (int i = 0; i < interfaces.length; i++) {
-            Method method = internalGetMethod(interfaces[i], methodName, 
parameterCount);
+        for (Class<?> anInterface : interfaces) {
+            Method method = internalGetMethod(anInterface, methodName, 
parameterCount);
             if (method != null) {
                 return method;
             }

Modified: 
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/DescribeTestCase.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/DescribeTestCase.java?rev=1712414&r1=1712413&r2=1712414&view=diff
==============================================================================
--- 
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/DescribeTestCase.java
 (original)
+++ 
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/DescribeTestCase.java
 Tue Nov  3 21:07:32 2015
@@ -76,8 +76,8 @@ public class DescribeTestCase {
         assertNotNull(properties);
 
         // Verify existence of all the properties that should be present
-        for (int i = 0; i < describes.length; i++) {
-            assertTrue("Property '" + describes[i] + "' is not present", 
properties.containsKey(describes[i]));
+        for (String describe : describes) {
+            assertTrue("Property '" + describe + "' is not present", 
properties.containsKey(describe));
         }
 
         assertTrue(properties.containsKey("class"));


Reply via email to