You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2016/09/08 19:42:57 UTC
svn commit: r1759895 - in
/pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox:
XMPMetadata.java schema/XMPSchema.java
Author: tilman
Date: Thu Sep 8 19:42:57 2016
New Revision: 1759895
URL: http://svn.apache.org/viewvc?rev=1759895&view=rev
Log:
PDFBOX-2852: use foreach loop, as suggested by Simon Steiner
Modified:
pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/XMPMetadata.java
pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPSchema.java
Modified: pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/XMPMetadata.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/XMPMetadata.java?rev=1759895&r1=1759894&r2=1759895&view=diff
==============================================================================
--- pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/XMPMetadata.java (original)
+++ pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/XMPMetadata.java Thu Sep 8 19:42:57 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/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPSchema.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPSchema.java?rev=1759895&r1=1759894&r2=1759895&view=diff
==============================================================================
--- pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPSchema.java (original)
+++ pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPSchema.java Thu Sep 8 19:42:57 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;