title: Implementation of NodeList
body: <p>I implemented <code>NodeList</code> like this   : </p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Collections;
  
  import org.w3c.dom.Node;
  import org.w3c.dom.NodeList;
  
  
  public class MyNodeList  implements NodeList{
  
      //// local member  ... 
      ArrayList&lt;Node&gt; arrayNode   = new ArrayList&lt;Node&gt;() ; 
      ////
  
      @Override
      public int getLength() {
          return arrayNode.size() ; 
      }
  
      @Override
      public Node item(int index) {
          return (arrayNode.get(index)).cloneNode(true); 
      }
  
      public void reverse ()  {
          Collections.reverse(arrayNode);
      }
  
      public void castNodeToMyNode (NodeList nodeListToCast) {
          int lenList = nodeListToCast.getLength();
          for (int i = 0; i &lt; lenList; i++) {
              this.arrayNode.add(nodeListToCast.item(i)) ; 
          }
      }
      public void appendNodeList (NodeList nodeListToappend) {
          this.castNodeToMyNode(nodeListToappend)  ; 
      }
  
  }
  </code></pre>
  
  <p>i have to do this cause i need the method <code>reverse</code>  - revese the order of the <code>NodeList</code> . </p>
  
  <p>my question is  :  when is use <code>evaluate</code> function - <code>Object result = xpath.evaluate(expression, source,
                  XPathConstants.NODESET);</code></p>
  
  <p>I want to set <code>source</code> argument as <code>item</code> of the <code>MyNodeList</code> implementation. Is it OK to set the <code>sourcec</code> as <code>myNodeAfterProbExp.item(indexOfNode)</code> when <code>myNodeAfterProbExp</code>
  is an object of <code>MyNodeList</code> ?
  I did something like this but I think it's disruptive for the execution of <code>evaluate</code>.</p>
  
  <p>Thanks in advance.</p>