Java tutorial
//package com.java2s; import org.w3c.dom.*; import java.util.*; public class Main { /** * Clone all the nodes contains in the provided node list, assuming they are of type {@link Element}, and return them in a {@link List}. * * @param nodelist Node list * @return {@link List} of cloned nodes */ public static List<Element> toElementList(NodeList nodelist) { ArrayList<Element> list = new ArrayList<Element>(nodelist.getLength()); for (int i = 0; i < nodelist.getLength(); i++) { list.add((Element) nodelist.item(i)); } return list; } }