Skip to content

Commit 7a438df

Browse files
committed
PDFBOX-5660: optimize, as suggested by Valery Bokov; closes #229
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1928105 13f79535-47bb-0310-9956-ffa450edef68
1 parent ce91f53 commit 7a438df

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pdfbox/src/main/java/org/apache/pdfbox/multipdf/Overlay.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,9 @@ private LayoutPage createLayoutPage(PDPage page) throws IOException
335335
private Map<Integer,LayoutPage> createPageOverlayLayoutPageMap(PDDocument doc) throws IOException
336336
{
337337
int i = 0;
338-
Map<Integer, LayoutPage> layoutPages = new HashMap<>();
339-
for (PDPage page : doc.getPages())
338+
PDPageTree pageTree = doc.getPages();
339+
Map<Integer, LayoutPage> layoutPages = new HashMap<>(pageTree.getCount());
340+
for (PDPage page : pageTree)
340341
{
341342
layoutPages.put(i, createLayoutPage(page));
342343
i++;

0 commit comments

Comments
 (0)