Java 类org.apache.commons.collections4.iterators.NodeListIterator 实例源码

项目:sdcct    文件:SdcctDomUtils.java   
public static Stream<Node> streamChildNodes(@Nullable Node node) {
    if (node == null) {
        return Stream.empty();
    }

    NodeList childNodes = node.getChildNodes();

    return SdcctIteratorUtils.stream(new NodeListIterator(childNodes), childNodes.getLength());
}
项目:crigtt    文件:CrigttXmlUtils.java   
public static List<String> extractTextContent(List<String> textContent, Node node) {
    CrigttIteratorUtils.stream(new NodeListIterator(node)).forEach(childNode -> {
        if (childNode instanceof Text) {
            textContent.add(childNode.getNodeValue());
        } else if (childNode instanceof Element) {
            extractTextContent(textContent, childNode);
        }
    });

    return textContent;
}
项目:HCFCore    文件:IteratorUtils.java   
/**
 * Gets an {@link Iterator} that wraps the specified {@link NodeList}.
 * The returned {@link Iterator} can be used for a single iteration.
 *
 * @param nodeList  the node list to use, may not be null
 * @return a new, single use {@link Iterator}
 * @throws NullPointerException if nodeList is null
 * @since 4.0
 */
public static NodeListIterator nodeListIterator(final NodeList nodeList) {
    if (nodeList == null) {
        throw new NullPointerException("NodeList must not be null");
    }
    return new NodeListIterator(nodeList);
}
项目:HCFCore    文件:IteratorUtils.java   
/**
 * Gets an {@link Iterator} that wraps the specified node's childNodes.
 * The returned {@link Iterator} can be used for a single iteration.
 * <p>
 * Convenience method, allows easy iteration over NodeLists:
 * <pre>
 *   Iterator&lt;Node&gt; iterator = IteratorUtils.nodeListIterator(node);
 *   for(Node childNode : IteratorUtils.asIterable(iterator)) {
 *     ...
 *   }
 * </pre>
 *
 * @param node  the node to use, may not be null
 * @return a new, single use {@link Iterator}
 * @throws NullPointerException if node is null
 * @since 4.0
 */
public static NodeListIterator nodeListIterator(final Node node) {
    if (node == null) {
        throw new NullPointerException("Node must not be null");
    }
    return new NodeListIterator(node);
}
项目:HCFCore    文件:IteratorUtils.java   
/**
 * Gets an {@link Iterator} that wraps the specified {@link NodeList}.
 * The returned {@link Iterator} can be used for a single iteration.
 *
 * @param nodeList  the node list to use, may not be null
 * @return a new, single use {@link Iterator}
 * @throws NullPointerException if nodeList is null
 * @since 4.0
 */
public static NodeListIterator nodeListIterator(final NodeList nodeList) {
    if (nodeList == null) {
        throw new NullPointerException("NodeList must not be null");
    }
    return new NodeListIterator(nodeList);
}
项目:HCFCore    文件:IteratorUtils.java   
/**
 * Gets an {@link Iterator} that wraps the specified node's childNodes.
 * The returned {@link Iterator} can be used for a single iteration.
 * <p>
 * Convenience method, allows easy iteration over NodeLists:
 * <pre>
 *   Iterator&lt;Node&gt; iterator = IteratorUtils.nodeListIterator(node);
 *   for(Node childNode : IteratorUtils.asIterable(iterator)) {
 *     ...
 *   }
 * </pre>
 *
 * @param node  the node to use, may not be null
 * @return a new, single use {@link Iterator}
 * @throws NullPointerException if node is null
 * @since 4.0
 */
public static NodeListIterator nodeListIterator(final Node node) {
    if (node == null) {
        throw new NullPointerException("Node must not be null");
    }
    return new NodeListIterator(node);
}