pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1759693 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripperByArea.java
Date Wed, 07 Sep 2016 20:17:26 GMT
Author: tilman
Date: Wed Sep  7 20:17:26 2016
New Revision: 1759693

URL: http://svn.apache.org/viewvc?rev=1759693&view=rev
Log:
PDFBOX-2852: user foreach loop, as suggested by Simon Steiner

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripperByArea.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripperByArea.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripperByArea.java?rev=1759693&r1=1759692&r2=1759693&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripperByArea.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/text/PDFTextStripperByArea.java
Wed Sep  7 20:17:26 2016
@@ -113,14 +113,13 @@ public class PDFTextStripperByArea exten
      */
     public void extractRegions( PDPage page ) throws IOException
     {
-        Iterator<String> regionIter = regions.iterator();
-        while( regionIter.hasNext() )
+        for (String region : regions)
         {
             setStartPage(getCurrentPageNo());
             setEndPage(getCurrentPageNo());
             //reset the stored text for the region so this class
             //can be reused.
-            String regionName = regionIter.next();
+            String regionName = region;
             ArrayList<List<TextPosition>> regionCharactersByArticle = new ArrayList<List<TextPosition>>();
             regionCharactersByArticle.add( new ArrayList<TextPosition>() );
             regionCharacterList.put( regionName, regionCharactersByArticle );
@@ -140,10 +139,8 @@ public class PDFTextStripperByArea exten
     @Override
     protected void processTextPosition( TextPosition text )
     {
-        Iterator<String> regionIter = regionArea.keySet().iterator();
-        while( regionIter.hasNext() )
+        for (String region : regionArea.keySet())
         {
-            String region = regionIter.next();
             Rectangle2D rect = regionArea.get( region );
             if( rect.contains( text.getX(), text.getY() ) )
             {
@@ -162,10 +159,8 @@ public class PDFTextStripperByArea exten
     @Override
     protected void writePage() throws IOException
     {
-        Iterator<String> regionIter = regionArea.keySet().iterator();
-        while( regionIter.hasNext() )
+        for (String region : regionArea.keySet())
         {
-            String region = regionIter.next();
             charactersByArticle = regionCharacterList.get( region );
             output = regionText.get( region );
             super.writePage();



Mime
View raw message