Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/* (c) 2015 Open Source Geospatial Foundation - all rights reserved
 * This code is licensed under the GPL 2.0 license, available at the root
 * application directory.
 */

import java.util.AbstractList;

import java.util.List;

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    /**
     * Make a Java List out of a DOM NodeList.
     *
     * @param nl
     */
    public static List<Node> nodeCollection(final NodeList nl) {
        return new AbstractList<Node>() {

            @Override
            public Node get(int index) {
                return nl.item(index);
            }

            @Override
            public int size() {
                return nl.getLength();
            }
        };
    }
}