pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1759896 - in /pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox: XMPMetadata.java schema/XMPSchema.java
Date Thu, 08 Sep 2016 19:43:02 GMT
Author: tilman
Date: Thu Sep  8 19:43:02 2016
New Revision: 1759896

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

Modified:
    pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/XMPMetadata.java
    pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPSchema.java

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/XMPMetadata.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/XMPMetadata.java?rev=1759896&r1=1759895&r2=1759896&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/XMPMetadata.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/XMPMetadata.java Thu Sep  8 19:43:02
2016
@@ -176,10 +176,9 @@ public class XMPMetadata
     public List<XMPSchema> getAllSchemas()
     {
         List<XMPSchema> schem = new ArrayList<XMPSchema>();
-        Iterator<XMPSchema> it = schemas.iterator();
-        while (it.hasNext())
+        for (XMPSchema schema : schemas)
         {
-            schem.add(it.next());
+            schem.add(schema);
         }
         return schem;
     }

Modified: pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPSchema.java?rev=1759896&r1=1759895&r2=1759896&view=diff
==============================================================================
--- pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPSchema.java (original)
+++ pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPSchema.java Thu Sep  8 19:43:02
2016
@@ -632,19 +632,17 @@ public class XMPSchema extends AbstractS
         if (array != null)
         {
             List<AbstractField> toDelete = new ArrayList<AbstractField>();
-            Iterator<AbstractField> it = array.getContainer().getAllProperties().iterator();
-            while (it.hasNext())
+            for (AbstractField abstractField : array.getContainer().getAllProperties())
             {
-                AbstractSimpleProperty tmp = (AbstractSimpleProperty) it.next();
+                AbstractSimpleProperty tmp = (AbstractSimpleProperty) abstractField;
                 if (tmp.getStringValue().equals(fieldValue))
                 {
                     toDelete.add(tmp);
                 }
             }
-            Iterator<AbstractField> eraseProperties = toDelete.iterator();
-            while (eraseProperties.hasNext())
+            for (AbstractField aToDelete : toDelete)
             {
-                array.getContainer().removeProperty(eraseProperties.next());
+                array.getContainer().removeProperty(aToDelete);
             }
         }
     }
@@ -750,19 +748,17 @@ public class XMPSchema extends AbstractS
         if (array != null)
         {
             List<AbstractField> toDelete = new ArrayList<AbstractField>();
-            Iterator<AbstractField> it = array.getContainer().getAllProperties().iterator();
-            while (it.hasNext())
+            for (AbstractField abstractField : array.getContainer().getAllProperties())
             {
-                AbstractSimpleProperty tmp = (AbstractSimpleProperty) it.next();
+                AbstractSimpleProperty tmp = (AbstractSimpleProperty) abstractField;
                 if (tmp.equals(fieldValue))
                 {
                     toDelete.add(tmp);
                 }
             }
-            Iterator<AbstractField> eraseProperties = toDelete.iterator();
-            while (eraseProperties.hasNext())
+            for (AbstractField aToDelete : toDelete)
             {
-                array.getContainer().removeProperty(eraseProperties.next());
+                array.getContainer().removeProperty(aToDelete);
             }
         }
     }
@@ -885,19 +881,16 @@ public class XMPSchema extends AbstractS
         if (seq != null)
         {
             List<AbstractField> toDelete = new ArrayList<AbstractField>();
-            Iterator<AbstractField> it = seq.getContainer().getAllProperties().iterator();
-            while (it.hasNext())
+            for (AbstractField tmp : seq.getContainer().getAllProperties())
             {
-                AbstractField tmp = it.next();
                 if (tmp instanceof DateType && ((DateType) tmp).getValue().equals(date))
                 {
                     toDelete.add(tmp);
                 }
             }
-            Iterator<AbstractField> eraseProperties = toDelete.iterator();
-            while (eraseProperties.hasNext())
+            for (AbstractField aToDelete : toDelete)
             {
-                seq.getContainer().removeProperty(eraseProperties.next());
+                seq.getContainer().removeProperty(aToDelete);
             }
         }
     }
@@ -996,10 +989,9 @@ public class XMPSchema extends AbstractS
                 reordered.add(tmp);
                 toDelete.add(tmp);
             }
-            Iterator<AbstractField> eraseProperties = toDelete.iterator();
-            while (eraseProperties.hasNext())
+            for (AbstractField aToDelete : toDelete)
             {
-                alt.removeProperty(eraseProperties.next());
+                alt.removeProperty(aToDelete);
             }
             it = reordered.iterator();
             while (it.hasNext())
@@ -1205,10 +1197,9 @@ public class XMPSchema extends AbstractS
         while (itNewValues.hasNext())
         {
             TextType tmpNewValue = (TextType) itNewValues.next();
-            Iterator<AbstractField> itOldValues = arrayProperty.getContainer().getAllProperties().iterator();
-            while (itOldValues.hasNext())
+            for (AbstractField abstractField : arrayProperty.getContainer().getAllProperties())
             {
-                TextType tmpOldValue = (TextType) itOldValues.next();
+                TextType tmpOldValue = (TextType) abstractField;
                 if (tmpOldValue.getStringValue().equals(tmpNewValue.getStringValue()))
                 {
                     return true;



Mime
View raw message