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 2021/03/13 14:26:13 UTC

svn commit: r1887597 - /pdfbox/trunk/xmpbox/src/main/java/org/apache/xmpbox/schema/XMPSchema.java

Author: tilman
Date: Sat Mar 13 14:26:13 2021
New Revision: 1887597

URL: http://svn.apache.org/viewvc?rev=1887597&view=rev
Log:
PDFBOX-4892: set individual initial ArrayList size, as suggested by valerybokov

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

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=1887597&r1=1887596&r2=1887597&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 Sat Mar 13 14:26:13 2021
@@ -1105,9 +1105,10 @@ public class XMPSchema extends AbstractS
         {
             if (property instanceof ArrayProperty)
             {
-                List<String> retval = new ArrayList<>();
                 ArrayProperty arrayProp = (ArrayProperty) property;
-                for (AbstractField child : arrayProp.getContainer().getAllProperties())
+                List<AbstractField> allProperties = arrayProp.getContainer().getAllProperties();
+                List<String> retval = new ArrayList<>(allProperties.size());
+                for (AbstractField child : allProperties)
                 {
                     Attribute text = child.getAttribute(XmpConstants.LANG_NAME);
                     retval.add(text != null ? text.getValue() : XmpConstants.X_DEFAULT);