commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r772553 - /commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ReflectionToStringBuilder.java
Date Thu, 07 May 2009 08:42:02 GMT
Author: bayard
Date: Thu May  7 08:42:01 2009
New Revision: 772553

URL: http://svn.apache.org/viewvc?rev=772553&view=rev
Log:
Type doesn't need to be ArrayList, and updating for loops

Modified:
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ReflectionToStringBuilder.java

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ReflectionToStringBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ReflectionToStringBuilder.java?rev=772553&r1=772552&r2=772553&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ReflectionToStringBuilder.java
(original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ReflectionToStringBuilder.java
Thu May  7 08:42:01 2009
@@ -20,9 +20,11 @@
 import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.List;
 
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.lang.ClassUtils;
@@ -340,9 +342,8 @@
      * @return The given array or a new array without null.
      */
     static String[] toNoNullStringArray(Object[] array) {
-        ArrayList<String> list = new ArrayList<String>(array.length);
-        for (int i = 0; i < array.length; i++) {
-            Object e = array[i];
+        List<String> list = new ArrayList<String>(array.length);
+        for (Object e : array) {
             if (e != null) {
                 list.add(e.toString());
             }
@@ -526,8 +527,7 @@
         }
         Field[] fields = clazz.getDeclaredFields();
         AccessibleObject.setAccessible(fields, true);
-        for (int i = 0; i < fields.length; i++) {
-            Field field = fields[i];
+        for (Field field : fields) {
             String fieldName = field.getName();
             if (this.accept(field)) {
                 try {



Mime
View raw message