Java XML NodeList toStream(final NodeList nodeList)

Here you can find the source of toStream(final NodeList nodeList)

Description

to Stream

License

Apache License

Declaration

public static Stream<Node> toStream(final NodeList nodeList) 

Method Source Code

//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();
    }
}

Related

  1. toList(final NodeList nodeList)
  2. toList(final NodeList nodes)
  3. toList(NodeList nodes)
  4. toNodeArray(NodeList list)
  5. toNodeArray(NodeList list)
  6. toStream(NodeList nodeList)