@Override public void remove() { if (index == 0) { throw new IllegalStateException(); } index--; parent.removeChild(children.item(index)); size = children.getLength(); }
@Override public Element next() { if (!hasNext()) { throw new NoSuchElementException(); } Element child = (Element) children.item(index); index++; return child; }
public ChildrenIterator(final Element parent) { this.parent = parent; this.children = parent.getChildren(); this.size = children.getLength(); this.index = 0; }