pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1768566 - in /pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples: ant/PDFToTextTask.java pdmodel/ExtractMetadata.java
Date Mon, 07 Nov 2016 17:55:33 GMT
Author: tilman
Date: Mon Nov  7 17:55:33 2016
New Revision: 1768566

URL: http://svn.apache.org/viewvc?rev=1768566&view=rev
Log:
PDFBOX-2852: replace while loop with foreach + add type argument to list, as suggested by
Lorenz Pahl

Modified:
    pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/ant/PDFToTextTask.java
    pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/ExtractMetadata.java

Modified: pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/ant/PDFToTextTask.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/ant/PDFToTextTask.java?rev=1768566&r1=1768565&r2=1768566&view=diff
==============================================================================
--- pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/ant/PDFToTextTask.java
(original)
+++ pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/ant/PDFToTextTask.java
Mon Nov  7 17:55:33 2016
@@ -19,7 +19,6 @@ package org.apache.pdfbox.examples.ant;
 import java.io.File;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.pdfbox.tools.ExtractText;
@@ -36,7 +35,7 @@ import org.apache.tools.ant.types.FileSe
  */
 public class PDFToTextTask extends Task
 {
-    private final List fileSets = new ArrayList();
+    private final List<FileSet> fileSets = new ArrayList<FileSet>();
 
     /**
      * Adds a set of files (nested fileset attribute).
@@ -55,11 +54,10 @@ public class PDFToTextTask extends Task
     public void execute()
     {
         log( "PDFToTextTask executing" );
-        Iterator fileSetIter = fileSets.iterator();
-        while( fileSetIter.hasNext() )
+
+        for (FileSet fileSet : fileSets)
         {
-            FileSet next = (FileSet)fileSetIter.next();
-            DirectoryScanner dirScanner = next.getDirectoryScanner( getProject() );
+            DirectoryScanner dirScanner = fileSet.getDirectoryScanner(getProject());
             dirScanner.scan();
             String[] files = dirScanner.getIncludedFiles();
             for (String file : files)

Modified: pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/ExtractMetadata.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/ExtractMetadata.java?rev=1768566&r1=1768565&r2=1768566&view=diff
==============================================================================
--- pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/ExtractMetadata.java
(original)
+++ pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/ExtractMetadata.java
Mon Nov  7 17:55:33 2016
@@ -146,10 +146,8 @@ public final class ExtractMetadata
             return;
         }
         System.out.println(title);
-        Iterator<String> iter = list.iterator();
-        while (iter.hasNext())
+        for (String string : list)
         {
-            String string = iter.next();
             System.out.println("  " + string);
         }
     }
@@ -161,10 +159,8 @@ public final class ExtractMetadata
             return;
         }
         System.out.println(title);
-        Iterator<Calendar> iter = list.iterator();
-        while (iter.hasNext())
+        for (Calendar calendar : list)
         {
-            Calendar calendar = iter.next();
             System.out.println("  " + format(calendar));
         }
     }



Mime
View raw message