[jdom-interest] Reverse order of children

Les Hill leh at galaxynine.com
Wed Apr 17 14:14:46 PDT 2002

<matthias.lendholt at bln1.siemens.de> writes:
> what is the best way to get a list of all children (of an element) in the
> reverse order ? Neither Element nor List have a function for that.

Try something like (from memory):

    List content = element.getContent();
    List clonedList = new ArrayList(content);

    for (Iterator i = clonedList.iterator(); i.hasNext();)
        // you are now iterating over a reverse list

Les Hill
leh at galaxynine.com

More information about the jdom-interest mailing list