commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1806244 - in /commons/proper/digester/trunk/examples: api/addressbook/src/main/java/org/apache/commons/digester3/examples/api/addressbook/ api/catalog/src/main/java/org/apache/commons/digester3/examples/api/catalog/ api/dbinsert/src/main/j...
Date Fri, 25 Aug 2017 21:52:01 GMT
Author: ggregory
Date: Fri Aug 25 21:52:01 2017
New Revision: 1806244

URL: http://svn.apache.org/viewvc?rev=1806244&view=rev
Log:
Convert 'for' loops to enhanced 'for' loops.

Modified:
    commons/proper/digester/trunk/examples/api/addressbook/src/main/java/org/apache/commons/digester3/examples/api/addressbook/AddressBook.java
    commons/proper/digester/trunk/examples/api/addressbook/src/main/java/org/apache/commons/digester3/examples/api/addressbook/Person.java
    commons/proper/digester/trunk/examples/api/catalog/src/main/java/org/apache/commons/digester3/examples/api/catalog/Catalog.java
    commons/proper/digester/trunk/examples/api/dbinsert/src/main/java/org/apache/commons/digester3/examples/api/dbinsert/RowInserterRule.java
    commons/proper/digester/trunk/examples/plugins/pipeline/src/main/java/org/apache/commons/digester3/examples/plugins/pipeline/CompoundTransform.java
    commons/proper/digester/trunk/examples/rss/src/main/java/org/apache/commons/digester3/rss/Channel.java
    commons/proper/digester/trunk/examples/xmlrules/addressbook/src/main/java/org/apache/commons/digester3/examples/xmlrules/addressbook/AddressBook.java
    commons/proper/digester/trunk/examples/xmlrules/addressbook/src/main/java/org/apache/commons/digester3/examples/xmlrules/addressbook/Person.java

Modified: commons/proper/digester/trunk/examples/api/addressbook/src/main/java/org/apache/commons/digester3/examples/api/addressbook/AddressBook.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/examples/api/addressbook/src/main/java/org/apache/commons/digester3/examples/api/addressbook/AddressBook.java?rev=1806244&r1=1806243&r2=1806244&view=diff
==============================================================================
--- commons/proper/digester/trunk/examples/api/addressbook/src/main/java/org/apache/commons/digester3/examples/api/addressbook/AddressBook.java
(original)
+++ commons/proper/digester/trunk/examples/api/addressbook/src/main/java/org/apache/commons/digester3/examples/api/addressbook/AddressBook.java
Fri Aug 25 21:52:01 2017
@@ -18,7 +18,6 @@ package org.apache.commons.digester3.exa
  */ 
 
 import java.util.LinkedList;
-import java.util.Iterator;
 
 /**
  * See Main.java.
@@ -37,9 +36,7 @@ public class AddressBook
     {
         System.out.println( "Address book has " + people.size() + " entries" );
 
-        for ( Iterator<Person> i = people.iterator(); i.hasNext(); )
-        {
-            Person p = i.next();
+        for (Person p : people) {
             p.print();
         }
     }

Modified: commons/proper/digester/trunk/examples/api/addressbook/src/main/java/org/apache/commons/digester3/examples/api/addressbook/Person.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/examples/api/addressbook/src/main/java/org/apache/commons/digester3/examples/api/addressbook/Person.java?rev=1806244&r1=1806243&r2=1806244&view=diff
==============================================================================
--- commons/proper/digester/trunk/examples/api/addressbook/src/main/java/org/apache/commons/digester3/examples/api/addressbook/Person.java
(original)
+++ commons/proper/digester/trunk/examples/api/addressbook/src/main/java/org/apache/commons/digester3/examples/api/addressbook/Person.java
Fri Aug 25 21:52:01 2017
@@ -19,7 +19,6 @@ package org.apache.commons.digester3.exa
 
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -73,17 +72,13 @@ public class Person
         System.out.println( "  category=" + category );
         System.out.println( "  name=" + name );
 
-        for ( Iterator<String> i = emails.keySet().iterator(); i.hasNext(); )
-        {
-            String type = i.next();
+        for (String type : emails.keySet()) {
             String address = emails.get( type );
 
             System.out.println( "  email (type " + type + ") : " + address );
         }
 
-        for ( Iterator<Address> i = addresses.iterator(); i.hasNext(); )
-        {
-            Address addr = i.next();
+        for (Address addr : addresses) {
             addr.print( System.out, 2 );
         }
     }

Modified: commons/proper/digester/trunk/examples/api/catalog/src/main/java/org/apache/commons/digester3/examples/api/catalog/Catalog.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/examples/api/catalog/src/main/java/org/apache/commons/digester3/examples/api/catalog/Catalog.java?rev=1806244&r1=1806243&r2=1806244&view=diff
==============================================================================
--- commons/proper/digester/trunk/examples/api/catalog/src/main/java/org/apache/commons/digester3/examples/api/catalog/Catalog.java
(original)
+++ commons/proper/digester/trunk/examples/api/catalog/src/main/java/org/apache/commons/digester3/examples/api/catalog/Catalog.java
Fri Aug 25 21:52:01 2017
@@ -18,7 +18,6 @@ package org.apache.commons.digester3.exa
  */ 
 
 import java.util.LinkedList;
-import java.util.Iterator;
 
 /**
  * See Main.java.
@@ -37,9 +36,7 @@ public class Catalog
     {
         System.out.println( "This catalog has " + items.size() + " items" );
 
-        for ( Iterator<Item> i = items.iterator(); i.hasNext(); )
-        {
-            Item item = i.next();
+        for (Item item : items) {
             item.print();
         }
     }

Modified: commons/proper/digester/trunk/examples/api/dbinsert/src/main/java/org/apache/commons/digester3/examples/api/dbinsert/RowInserterRule.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/examples/api/dbinsert/src/main/java/org/apache/commons/digester3/examples/api/dbinsert/RowInserterRule.java?rev=1806244&r1=1806243&r2=1806244&view=diff
==============================================================================
--- commons/proper/digester/trunk/examples/api/dbinsert/src/main/java/org/apache/commons/digester3/examples/api/dbinsert/RowInserterRule.java
(original)
+++ commons/proper/digester/trunk/examples/api/dbinsert/src/main/java/org/apache/commons/digester3/examples/api/dbinsert/RowInserterRule.java
Fri Aug 25 21:52:01 2017
@@ -18,7 +18,6 @@ package org.apache.commons.digester3.exa
  */ 
 
 import java.sql.Connection;
-import java.util.Iterator;
 
 import org.apache.commons.digester3.Rule;
 import org.apache.commons.digester3.examples.api.dbinsert.Row.Column;
@@ -80,10 +79,7 @@ public class RowInserterRule
         StringBuilder colnames = new StringBuilder();
         StringBuilder colvalues = new StringBuilder();
 
-        for ( Iterator<Column> i = row.getColumns().iterator(); i.hasNext(); )
-        {
-            Column column = i.next();
-
+        for (Column column : row.getColumns()) {
             if ( colnames.length() > 0 )
             {
                 colnames.append( ", " );

Modified: commons/proper/digester/trunk/examples/plugins/pipeline/src/main/java/org/apache/commons/digester3/examples/plugins/pipeline/CompoundTransform.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/examples/plugins/pipeline/src/main/java/org/apache/commons/digester3/examples/plugins/pipeline/CompoundTransform.java?rev=1806244&r1=1806243&r2=1806244&view=diff
==============================================================================
--- commons/proper/digester/trunk/examples/plugins/pipeline/src/main/java/org/apache/commons/digester3/examples/plugins/pipeline/CompoundTransform.java
(original)
+++ commons/proper/digester/trunk/examples/plugins/pipeline/src/main/java/org/apache/commons/digester3/examples/plugins/pipeline/CompoundTransform.java
Fri Aug 25 21:52:01 2017
@@ -18,7 +18,6 @@ package org.apache.commons.digester3.exa
  */ 
 
 import java.util.LinkedList;
-import java.util.Iterator;
 
 import org.apache.commons.digester3.Digester;
 import org.apache.commons.digester3.plugins.PluginCreateRule;
@@ -45,9 +44,7 @@ public class CompoundTransform
     @Override
     public String transform( String s )
     {
-        for ( Iterator<Transform> i = transforms.iterator(); i.hasNext(); )
-        {
-            Transform t = i.next();
+        for (Transform t : transforms) {
             s = t.transform( s );
         }
         return s;

Modified: commons/proper/digester/trunk/examples/rss/src/main/java/org/apache/commons/digester3/rss/Channel.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/examples/rss/src/main/java/org/apache/commons/digester3/rss/Channel.java?rev=1806244&r1=1806243&r2=1806244&view=diff
==============================================================================
--- commons/proper/digester/trunk/examples/rss/src/main/java/org/apache/commons/digester3/rss/Channel.java
(original)
+++ commons/proper/digester/trunk/examples/rss/src/main/java/org/apache/commons/digester3/rss/Channel.java
Fri Aug 25 21:52:01 2017
@@ -600,10 +600,9 @@ public class Channel
         if ( skipDays.length > 0 )
         {
             writer.println( "    <skipDays>" );
-            for ( int i = 0; i < skipDays.length; i++ )
-            {
+            for (String skipDay : skipDays) {
                 writer.print( "      <skipDay>" );
-                writer.print( skipDays[i] );
+                writer.print( skipDay );
                 writer.println( "</skipDay>" );
             }
             writer.println( "    </skipDays>" );
@@ -613,10 +612,9 @@ public class Channel
         if ( skipHours.length > 0 )
         {
             writer.println( "    <skipHours>" );
-            for ( int i = 0; i < skipHours.length; i++ )
-            {
+            for (String skipHour : skipHours) {
                 writer.print( "      <skipHour>" );
-                writer.print( skipHours[i] );
+                writer.print( skipHour );
                 writer.println( "</skipHour>" );
             }
             writer.println( "    </skipHours>" );
@@ -624,9 +622,8 @@ public class Channel
         }
 
         Item items[] = findItems();
-        for ( int i = 0; i < items.length; i++ )
-        {
-            items[i].render( writer );
+        for (Item item : items) {
+            item.render( writer );
             writer.println();
         }
 

Modified: commons/proper/digester/trunk/examples/xmlrules/addressbook/src/main/java/org/apache/commons/digester3/examples/xmlrules/addressbook/AddressBook.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/examples/xmlrules/addressbook/src/main/java/org/apache/commons/digester3/examples/xmlrules/addressbook/AddressBook.java?rev=1806244&r1=1806243&r2=1806244&view=diff
==============================================================================
--- commons/proper/digester/trunk/examples/xmlrules/addressbook/src/main/java/org/apache/commons/digester3/examples/xmlrules/addressbook/AddressBook.java
(original)
+++ commons/proper/digester/trunk/examples/xmlrules/addressbook/src/main/java/org/apache/commons/digester3/examples/xmlrules/addressbook/AddressBook.java
Fri Aug 25 21:52:01 2017
@@ -18,7 +18,6 @@ package org.apache.commons.digester3.exa
  */ 
 
 import java.util.LinkedList;
-import java.util.Iterator;
 
 /**
  * See Main.java.
@@ -37,9 +36,7 @@ public class AddressBook
     {
         System.out.println( "Address book has " + people.size() + " entries" );
 
-        for ( Iterator<Person> i = people.iterator(); i.hasNext(); )
-        {
-            Person p = i.next();
+        for (Person p : people) {
             p.print();
         }
     }

Modified: commons/proper/digester/trunk/examples/xmlrules/addressbook/src/main/java/org/apache/commons/digester3/examples/xmlrules/addressbook/Person.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/examples/xmlrules/addressbook/src/main/java/org/apache/commons/digester3/examples/xmlrules/addressbook/Person.java?rev=1806244&r1=1806243&r2=1806244&view=diff
==============================================================================
--- commons/proper/digester/trunk/examples/xmlrules/addressbook/src/main/java/org/apache/commons/digester3/examples/xmlrules/addressbook/Person.java
(original)
+++ commons/proper/digester/trunk/examples/xmlrules/addressbook/src/main/java/org/apache/commons/digester3/examples/xmlrules/addressbook/Person.java
Fri Aug 25 21:52:01 2017
@@ -19,7 +19,6 @@ package org.apache.commons.digester3.exa
 
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -73,17 +72,13 @@ public class Person
         System.out.println( "  category=" + category );
         System.out.println( "  name=" + name );
 
-        for ( Iterator<String> i = emails.keySet().iterator(); i.hasNext(); )
-        {
-            String type = i.next();
+        for (String type : emails.keySet()) {
             String address = emails.get( type );
 
             System.out.println( "  email (type " + type + ") : " + address );
         }
 
-        for ( Iterator<Address> i = addresses.iterator(); i.hasNext(); )
-        {
-            Address addr = i.next();
+        for (Address addr : addresses) {
             addr.print( System.out, 2 );
         }
     }



Mime
View raw message