diff options
Diffstat (limited to 'src/main/java/com/lowagie')
-rw-r--r-- | src/main/java/com/lowagie/text/pdf/PdfDictionary.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main/java/com/lowagie/text/pdf/PdfDictionary.java b/src/main/java/com/lowagie/text/pdf/PdfDictionary.java index f7310e4..acf84d5 100644 --- a/src/main/java/com/lowagie/text/pdf/PdfDictionary.java +++ b/src/main/java/com/lowagie/text/pdf/PdfDictionary.java @@ -105,11 +105,20 @@ public class PdfDictionary extends PdfObject { /** This is the hashmap that contains all the values and keys of the dictionary */
protected HashMap hashMap;
+
+ // EGIZ various modifications
/**
* This list preserves the order of the elements.
+ *
+ * <p>
+ * If an element to be added to the list already exists in the list,
+ * it sould not be added as the contents of this new element
+ * overwrites the contents of the old element in the hash map.
+ * </p>
*/
protected List list;
+
// constructors
/**
@@ -175,8 +184,13 @@ public class PdfDictionary extends PdfObject { */
public void put(PdfName key, PdfObject value) {
+ if (!hashMap.containsKey(key))
+ {
+ // If the key is new, add it to the ordered list.
+ // If not, it already has a position in the list.
+ list.add(key);
+ }
hashMap.put(key, value);
- list.add(key);
}
/**
|