pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1846335 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java
Date Sun, 11 Nov 2018 07:58:35 GMT
Author: tilman
Date: Sun Nov 11 07:58:34 2018
New Revision: 1846335

URL: http://svn.apache.org/viewvc?rev=1846335&view=rev
Log:
PDFBOX-4375: use a Set instead of a Map

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java?rev=1846335&r1=1846334&r2=1846335&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java Sun Nov
11 07:58:34 2018
@@ -25,8 +25,10 @@ import java.io.OutputStream;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import org.apache.pdfbox.cos.COSArray;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
@@ -62,7 +64,7 @@ public class Overlay implements Closeabl
     private LayoutPage oddPageOverlayPage;
     private LayoutPage evenPageOverlayPage;
 
-    private final Map<Integer, PDDocument> openDocumentsMap = new HashMap<Integer,
PDDocument>();
+    private final Set<PDDocument> openDocuments = new HashSet<PDDocument>();
     private Map<Integer, LayoutPage> specificPageOverlayPage = new HashMap<Integer,
LayoutPage>();
 
     private Position position = Position.BACKGROUND;
@@ -117,7 +119,7 @@ public class Overlay implements Closeabl
                 loadedDocuments.put(e.getValue(), doc);
                 layouts.put(doc, getLayoutPage(doc));
             }
-            openDocumentsMap.put(e.getKey(), doc);
+            openDocuments.add(doc);
             specificPageOverlayPage.put(e.getKey(), layouts.get(doc));
         }
         processPages(inputPDFDocument);
@@ -156,11 +158,11 @@ public class Overlay implements Closeabl
         {
             evenPageOverlay.close();
         }
-        for (PDDocument doc : openDocumentsMap.values())
+        for (PDDocument doc : openDocuments)
         {
             doc.close();
         }
-        openDocumentsMap.clear();
+        openDocuments.clear();
         specificPageOverlayPage.clear();
     }
 



Mime
View raw message