Here you can find the source of toElementIterable(NodeList nodeList)
public static Iterable<Element> toElementIterable(NodeList nodeList)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); you may not import org.w3c.dom.Element; import org.w3c.dom.NodeList; import java.util.ArrayList; import java.util.List; public class Main { /** Converts a NodeList to an Iterable of Elements. */ public static Iterable<Element> toElementIterable(NodeList nodeList) { List<Element> elements = new ArrayList<>(nodeList.getLength()); for (int i = 0; i < nodeList.getLength(); i++) { elements.add((Element) nodeList.item(i)); }//from ww w. j a v a2 s.co m return elements; } }