Class NodeListImpl

All Implemented Interfaces:
Iterable<Node>, Collection<Node>, List<Node>, SequencedCollection<Node>, NodeList, ScriptableDelegate

public class NodeListImpl extends AbstractList<Node> implements NodeList

NodeListImpl class.

  • Constructor Details

    • NodeListImpl

      public NodeListImpl()

      Constructor for NodeListImpl.

      * @param rootNode a NodeImpl object.
    • NodeListImpl

      public NodeListImpl(List<Node> collection)

      Constructor for NodeListImpl.

      Parameters:
      collection - a List object.
  • Method Details

    • getLength

      public int getLength()
      Returns the number of nodes in the collection.
      Specified by:
      getLength in interface NodeList
      Returns:
      a Integer object.
    • item

      public Node item(int index)
      Returns the node with index index from the collection. The nodes are sorted in tree order.
      Specified by:
      item in interface NodeList
      Parameters:
      index - a Integer object.
      Returns:
      a Node object.
    • entries

      public ES6Iterator entries()
      Returns an iterator, allowing code to go through all key/value pairs contained in the collection.
      Specified by:
      entries in interface NodeList
      Returns:
      a ES6Iterator object.
    • keys

      public ES6Iterator keys()
      Returns an iterator, allowing code to go through all the keys of the key/value pairs contained in the collection.
      Specified by:
      keys in interface NodeList
      Returns:
      a ES6Iterator object.
    • values

      public ES6Iterator values()
      Returns an iterator allowing code to go through all values (nodes) of the key/value pairs contained in the collection.
      Specified by:
      values in interface NodeList
      Returns:
      a ES6Iterator object.
    • forEach

      public void forEach(Function function)
      Executes a provided function once per NodeList element, passing the element as an argument to the function.
      Specified by:
      forEach in interface NodeList
      Parameters:
      function - a Function object.
    • toArray

      public Node[] toArray()
      Specified by:
      toArray in interface Collection<Node>
      Specified by:
      toArray in interface List<Node>
      Specified by:
      toArray in interface NodeList
      Overrides:
      toArray in class AbstractList<Node>
      Returns:
      an array of Node objects.
    • toString

      public String toString()
      Overrides:
      toString in class Object