Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.List;

import org.w3c.dom.Element;

public class Main {
    /**
     * Adds an attribute with the list of integer values encoded as a string.
     * @param element        the element to which the attribute will be added
     * @param attributeName  the name of the attribute
     * @param intValues      the list of Integer values to set
     */
    public static void setIntegerListAttribute(Element element, String attributeName, List<Integer> intValues) {
        StringBuilder sb = new StringBuilder();
        for (Integer intValue : intValues) {
            if (sb.length() == 0) {
                sb.append(" "); //$NON-NLS-1$
            }
            sb.append(intValue);
        }

        element.setAttribute(attributeName, sb.toString());
    }
}