Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.AbstractList;
import java.util.List;

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

public class Main {
    public static List<Node> childrenAsList(Node node) {
        final NodeList children = node.getChildNodes();
        return new AbstractList<Node>() {

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

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

        };
    }
}