Here you can find the source of toStream(final NodeList nodeList)
public static Stream<Node> toStream(final NodeList nodeList)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Node; import org.w3c.dom.NodeList; import java.util.AbstractList; import java.util.stream.Stream; public class Main { public static Stream<Node> toStream(final NodeList nodeList) { return new AbstractList<Node>() { @Override//from w w w . ja v a 2s . c om public int size() { return nodeList.getLength(); } @Override public Node get(int index) { return nodeList.item(index); } }.stream(); } }