title: How to use org.w3c.dom.NodeList with Java 8 Stream API?
body: <p>I believe the Interface <a href="http://docs.oracle.com/javase/8/docs/api/org/w3c/dom/NodeList.html">org.w3c.dom.NodeList</a> is missing a <code>stream()</code> function to make use of the benefits of Java 8's Stream API. Considering the introduction of default methods to ensure backwards compatibility, I fail to understand why this Interface doesn't have <code>stream()</code> function. </p>
  
  <p>So my questions are: </p>
  
  <ul>
  <li>How do I use a <code>NodeList</code> in combination with the Stream API?</li>
  <li>If it's discouraged to do so, what are the reasons for that?</li>
  </ul>
  
  <p>Thanks in advance!</p>
  
  <p>Edit: I'm currently using this utility wrapper:</p>
  
  <pre><code>private static Stream&lt;Node&gt; nodeStream(NodeList list) {
      List&lt;Node&gt; nodes = new ArrayList&lt;&gt;();
  
      for (int n = 0; n &lt; list.getLength(); ++n) {
          nodes.add(list.item(n));
      }
  
      return nodes.stream();
  }
  </code></pre>