Class SimpleNodeList

java.lang.Object
org.jdesktop.dom.SimpleNodeList
All Implemented Interfaces:
Iterable<Node>, NodeList

public class SimpleNodeList extends Object implements NodeList, Iterable<Node>

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 Details

    • SimpleNodeList

      public SimpleNodeList(NodeList list)
      Creates a new instance of SimpleNodeList.
      Parameters:
      list - the NodeList to wrap.
    • SimpleNodeList

      public SimpleNodeList(List<Node> nodes)
      Create a new SimpleNodeList that wraps the given nodes
      Parameters:
      nodes - the nodes to wrap
    • SimpleNodeList

      public SimpleNodeList(Node... nodes)
      Create a new SimpleNodeList that wraps the given nodes
      Parameters:
      nodes - the nodes to wrap
  • Method Details