|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jdesktop.dom.SimpleNodeList
public class SimpleNodeList
An implementation of NodeList which also implements
Iterable. This allows you to use a SimpleNodeList in an enhanced
for loop, such as:
SimpleNodeList nodes = ...;
for (Node n : nodes) {
System.out.println(n.getTextContent());
}
SimpleNodeList wraps a source NodeList. Thus, any NodeList can be adapted for use with enhanced for loops by wrapping it in a SimpleNodeList.
| Constructor Summary | |
|---|---|
SimpleNodeList(List<Node> nodes)
Create a new SimpleNodeList that wraps the given nodes |
|
SimpleNodeList(Node... nodes)
Create a new SimpleNodeList that wraps the given nodes |
|
SimpleNodeList(NodeList list)
Creates a new instance of SimpleNodeList. |
|
| Method Summary | |
|---|---|
int |
getLength()
The number of nodes in the list. |
Node |
item(int index)
Returns the indexth item in the collection. |
Iterator<Node> |
iterator()
Returns an iterator over a set of elements of type T. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleNodeList(NodeList list)
list - the NodeList to wrap.public SimpleNodeList(List<Node> nodes)
nodes - the nodes to wrappublic SimpleNodeList(Node... nodes)
nodes - the nodes to wrap| Method Detail |
|---|
public Node item(int index)
org.w3c.dom.NodeListindexth item in the collection. If
index is greater than or equal to the number of nodes in
the list, this returns null.
item in interface NodeListindex - Index into the collection.
indexth position in the
NodeList, or null if that is not a valid
index.public int getLength()
org.w3c.dom.NodeListlength-1 inclusive.
getLength in interface NodeListpublic Iterator<Node> iterator()
java.lang.Iterable
iterator in interface Iterable<Node>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||