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 2022/09/11 18:20:30 UTC
svn commit: r1904000 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java
Author: tilman
Date: Sun Sep 11 18:20:30 2022
New Revision: 1904000
URL: http://svn.apache.org/viewvc?rev=1904000&view=rev
Log:
PDFBOX-5499: use LinkedHashMap when SmallMap has more than 100 elements
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java?rev=1904000&r1=1903999&r2=1904000&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java Sun Sep 11 18:20:30 2022
@@ -63,11 +63,7 @@ public class COSDictionary extends COSBa
*/
public COSDictionary(COSDictionary dict)
{
- if (items instanceof SmallMap && items.size() + dict.items.size() >= 100)
- {
- items = new LinkedHashMap<COSName, COSBase>(items);
- }
- items.putAll(dict.items);
+ addAll(dict);
}
/**
@@ -1447,11 +1443,15 @@ public class COSDictionary extends COSBa
* This will add all of the dictionaries keys/values to this dictionary. Existing key/value pairs will be
* overwritten.
*
- * @param dic The dictionaries to get the key/value pairs from.
+ * @param dict The dictionaries to get the key/value pairs from.
*/
- public void addAll(COSDictionary dic)
+ public void addAll(COSDictionary dict)
{
- items.putAll(dic.items);
+ if (items instanceof SmallMap && items.size() + dict.items.size() >= 100)
+ {
+ items = new LinkedHashMap<COSName, COSBase>(items);
+ }
+ items.putAll(dict.items);
}
/**