Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Element.getChildren() javadoc out of date #131

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

Element.getChildren() javadoc out of date #131

skiwi2 opened this issue Apr 23, 2014 · 0 comments
Labels

Comments

@skiwi2
Copy link

@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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.