class DOMParserUtil {

    protected static Stream<Node> asStream(NodeList nodeList) {
        if (nodeList == null) {
            return new ArrayList<Node>().stream();
        } else {
            AtomicInteger n = new AtomicInteger(0);
            return Stream.generate(() -> nodeList.item(n.getAndIncrement())).limit(nodeList.getLength());
        }
    }

    private  DOMParserUtil();

}