commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject svn commit: r1651480 - /commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java
Date Tue, 13 Jan 2015 20:39:59 GMT
Author: britter
Date: Tue Jan 13 20:39:58 2015
New Revision: 1651480

URL: http://svn.apache.org/r1651480
Log:
Generics and enhanced for loop

Modified:
    commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java

Modified: commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java?rev=1651480&r1=1651479&r2=1651480&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java
(original)
+++ commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/AbstractCheckDigitTest.java
Tue Jan 13 20:39:58 2015
@@ -286,21 +286,21 @@ public abstract class AbstractCheckDigit
      * @return Codes with invalid check digits
      */
     protected String[] createInvalidCodes(String[] codes) {
-        List list = new ArrayList();
+        List<String> list = new ArrayList<String>();
 
         // create invalid check digit values
-        for (int i = 0; i < codes.length; i++) {
-            String code = removeCheckDigit(codes[i]);
-            String check  = checkDigit(codes[i]);
+        for (String fullCode : codes) {
+            String code = removeCheckDigit(fullCode);
+            String check = checkDigit(fullCode);
             for (int j = 0; j < POSSIBLE_CHECK_DIGITS.length(); j++) {
-                String curr =  POSSIBLE_CHECK_DIGITS.substring(j, j+1);//"" + Character.forDigit(j,
10);
+                String curr = POSSIBLE_CHECK_DIGITS.substring(j, j + 1);//"" + Character.forDigit(j,
10);
                 if (!curr.equals(check)) {
                     list.add(code + curr);
                 }
             }
         }
         
-        return (String[])list.toArray(new String[list.size()]);
+        return list.toArray(new String[list.size()]);
     }
 
     /**



Mime
View raw message