Element.getChildren() javadoc out of date #131

Closed
skiwi2 opened this Issue Apr 23, 2014 · 0 comments

Comments

Projects
None yet
2 participants
@skiwi2

skiwi2 commented Apr 23, 2014

The javadoc of Element.getChildren() is out of date, it seems to be carried over from JDOM 1.x:

  • Iterator itr = (currentElement.getChildren()).iterator();
  • while(itr.hasNext()) {
  • Element oneLevelDeep = (Element)itr.next();
  • List twoLevelsDeep = oneLevelDeep.getChildren();
  • // Do something with these children
  • }

I propose it to use generics and enhanced for-loop:
for (Element oneLevelDeep : currentElement.getChildren()) {
List twoLevelsDeep = oneLevelDeep.getChildren();
//do stuff
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment