Package com.globalmentor.xml
Class NodeListIterator
- java.lang.Object
-
- com.globalmentor.xml.AbstractNodeIterator<org.w3c.dom.Node>
-
- com.globalmentor.xml.NodeListIterator
-
- All Implemented Interfaces:
java.util.Iterator<org.w3c.dom.Node>
public class NodeListIterator extends AbstractNodeIterator<org.w3c.dom.Node>
Iterates through the nodes in aNodeList
. The original node list must not be modified externally during iteration.- Author:
- Garret Wilson
- Implementation Specification:
- This implementation fails fast, throwing a
ConcurrentModificationException
if it determines on a best-effort basis that the original node list has been modified. - See Also:
NodeList
-
-
Constructor Summary
Constructors Constructor Description NodeListIterator(org.w3c.dom.NodeList nodeList)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
getLength()
protected org.w3c.dom.Node
getNode(int index)
Retrieves the node at the given index from the underlying data structure.protected void
removeImpl(org.w3c.dom.Node node)
Implementation that actually removes the node from the underlying data structure.-
Methods inherited from class com.globalmentor.xml.AbstractNodeIterator
hasNext, next, remove
-
-
-
-
Method Detail
-
getLength
protected int getLength()
- Specified by:
getLength
in classAbstractNodeIterator<org.w3c.dom.Node>
- Returns:
- The current length of the underlying data structure.
-
getNode
protected org.w3c.dom.Node getNode(int index)
Description copied from class:AbstractNodeIterator
Retrieves the node at the given index from the underlying data structure.- Specified by:
getNode
in classAbstractNodeIterator<org.w3c.dom.Node>
- Parameters:
index
- The index of the node to retrieve.- Returns:
- The node at the given index, or
null
if the index is not valid.
-
removeImpl
protected void removeImpl(org.w3c.dom.Node node)
Implementation that actually removes the node from the underlying data structure.This method must not change any iterator state variables.
- Overrides:
removeImpl
in classAbstractNodeIterator<org.w3c.dom.Node>
- Implementation Specification:
- This implementation removes the attribute node by calling
Node.removeChild(Node)
on the node's parent node. - Parameters:
node
- The node to remove.- See Also:
Node.removeChild(Node)
-
-