class PdfCollectionSort extends PdfDictionary {

    /**
     * Constructs a PDF Collection Sort Dictionary.
     *
     * @param key the key of the field that will be used to sort entries
     */
    public PdfCollectionSort(String key) {
        super(PdfName.COLLECTIONSORT);
        put(PdfName.S, new PdfName(key));
    }

    /**
     * Constructs a PDF Collection Sort Dictionary.
     *
     * @param keys the keys of the fields that will be used to sort entries
     */
    public PdfCollectionSort(String[] keys) {
        super(PdfName.COLLECTIONSORT);
        PdfArray array = new PdfArray();
        for (String key : keys) {
            array.add(new PdfName(key));
        }
        put(PdfName.S, array);
    }

    /**
     * Defines the sort order of the field (ascending or descending).
     *
     * @param ascending true is the default, use false for descending order
     */
    public void setSortOrder(boolean ascending) {
        PdfObject o = get(PdfName.S);
        if (o instanceof PdfName) {
            put(PdfName.A, new PdfBoolean(ascending));
        } else {
            throw new IllegalArgumentException(MessageLocalization.getComposedMessage(
                    "you.have.to.define.a.boolean.array.for.this.collection.sort.dictionary"));
        }
    }

    /**
     * Defines the sort order of the field (ascending or descending).
     *
     * @param ascending an array with every element corresponding with a name of a field.
     */
    public void setSortOrder(boolean[] ascending) {<FILL_FUNCTION_BODY>}


}

        PdfObject o = get(PdfName.S);
        if (o instanceof PdfArray) {
            if (((PdfArray) o).size() != ascending.length) {
                throw new IllegalArgumentException(MessageLocalization.getComposedMessage(
                        "the.number.of.booleans.in.this.array.doesn.t.correspond.with.the.number.of.fields"));
            }
            PdfArray array = new PdfArray();
            for (boolean b : ascending) {
                array.add(new PdfBoolean(b));
            }
            put(PdfName.A, array);
        } else {
            throw new IllegalArgumentException(MessageLocalization.getComposedMessage(
                    "you.need.a.single.boolean.for.this.collection.sort.dictionary"));
        }
    
<methods>public void <init>() ,public void <init>(com.lowagie.text.pdf.PdfName) ,public void clear() ,public boolean contains(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfObject get(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfArray getAsArray(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfBoolean getAsBoolean(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfDictionary getAsDict(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfIndirectReference getAsIndirectObject(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfName getAsName(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfNumber getAsNumber(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfStream getAsStream(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfString getAsString(com.lowagie.text.pdf.PdfName) ,public com.lowagie.text.pdf.PdfObject getDirectObject(com.lowagie.text.pdf.PdfName) ,public Set<com.lowagie.text.pdf.PdfName> getKeys() ,public Set<Entry<com.lowagie.text.pdf.PdfName,com.lowagie.text.pdf.PdfObject>> getKeysAndValues() ,public boolean isCatalog() ,public boolean isFont() ,public boolean isOutlineTree() ,public boolean isPage() ,public boolean isPages() ,public void merge(com.lowagie.text.pdf.PdfDictionary) ,public void mergeDifferent(com.lowagie.text.pdf.PdfDictionary) ,public void put(com.lowagie.text.pdf.PdfName, com.lowagie.text.pdf.PdfObject) ,public void putAll(com.lowagie.text.pdf.PdfDictionary) ,public void putEx(com.lowagie.text.pdf.PdfName, com.lowagie.text.pdf.PdfObject) ,public void remove(com.lowagie.text.pdf.PdfName) ,public int size() ,public void toPdf(com.lowagie.text.pdf.PdfWriter, java.io.OutputStream) throws java.io.IOException,public java.lang.String toString() <variables>public static final com.lowagie.text.pdf.PdfName CATALOG,public static final com.lowagie.text.pdf.PdfName FONT,public static final com.lowagie.text.pdf.PdfName OUTLINES,public static final com.lowagie.text.pdf.PdfName PAGE,public static final com.lowagie.text.pdf.PdfName PAGES,private com.lowagie.text.pdf.PdfName dictionaryType,protected Map<com.lowagie.text.pdf.PdfName,com.lowagie.text.pdf.PdfObject> hashMap