PdfDictionary extends PdfObject { public Collection<PdfObject> values(boolean asDirects) { if (asDirects) { return values(); } else { return map.values(); } } PdfDictionary();  PdfDictionary(Map<PdfName, PdfObject> map);  PdfDictionary(Set<Map.Entry<PdfName, PdfObject>> entrySet);  PdfDictionary(PdfDictionary dictionary); int size(); boolean isEmpty(); boolean containsKey(PdfName key); boolean containsValue(PdfObject value); PdfObject get(PdfName key); PdfArray getAsArray(PdfName key); PdfDictionary getAsDictionary(PdfName key); PdfStream getAsStream(PdfName key); PdfNumber getAsNumber(PdfName key); PdfName getAsName(PdfName key); PdfString getAsString(PdfName key); PdfBoolean getAsBoolean(PdfName key); Rectangle getAsRectangle(PdfName key); Float getAsFloat(PdfName key); Integer getAsInt(PdfName key); Boolean getAsBool(PdfName key); PdfObject put(PdfName key, PdfObject value); PdfObject remove(PdfName key); void putAll(PdfDictionary d); void clear(); Set<PdfName> keySet(); Collection<PdfObject> values(boolean asDirects); Collection<PdfObject> values(); Set<Map.Entry<PdfName, PdfObject>> entrySet(); @Override byte getType(); @Override String toString(); PdfDictionary clone(List<PdfName> excludeKeys); PdfDictionary copyTo(PdfDocument document, List<PdfName> excludeKeys, boolean allowDuplicating); PdfObject get(PdfName key, boolean asDirect); void mergeDifferent(PdfDictionary other);  }
@Test public void testValues() { PdfDocument doc = new PdfDocument(new PdfWriter(new ByteArrayOutputStream())); PdfDictionary dict = new PdfDictionary(); dict.put(new PdfName("1"), new PdfNumber(1).makeIndirect(doc).getIndirectReference()); dict.put(new PdfName("2"), new PdfNumber(2).makeIndirect(doc).getIndirectReference()); dict.put(new PdfName("3"), new PdfNumber(3).makeIndirect(doc)); dict.put(new PdfName("4"), new PdfNumber(4).makeIndirect(doc)); dict.put(new PdfName("5"), new PdfNumber(5)); dict.put(new PdfName("6"), new PdfNumber(6)); List<Integer> nums = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6)); for (Map.Entry<PdfName, PdfObject> e: dict.entrySet()) { Assert.assertEquals(e.getKey().toString(), "/"+e.getValue()); if (!nums.remove(Integer.valueOf(((PdfNumber)e.getValue()).intValue()))) { Assert.fail("Element not found"); } } }