[jdom-interest] doc misleading

Guy Nirpaz guyn at tantian.com
Sun Nov 19 20:39:55 PST 2000


Hi,

I thing the documentation of the getChildren method of Element is
misleading. Since the internal list is a linked list, it is more efficient
to traverse all children elements with list iterator.

  * <code>
  *   List nestedElements = currentElement.getChildren();
  *   for (int i=0; i<nestedElements.size(); i++) {

+++++
  *     Element oneLevelDeep = (Element)nestedElements.get(i);

+++++
  *     List twoLevelsDeep = oneLevelDeep.getChildren();
  *     // Do something with these children
  *   }
  * </code>

the documentation should be something like


  * <code>
  *   List nestedElements = currentElement.getChildren();
  *   for (Iterator i = list.nestedElements.iterator() ; i.hasNext() ;) {
  *     Element oneLevelDeep = (Element)i.next()
  *     List twoLevelsDeep = oneLevelDeep.getChildren();
  *     // Do something with these children
  *   }
  * </code>


Guy Nirpaz
Java Architect

Tantian Corp.
guyn at tantian.com




More information about the jdom-interest mailing list