Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: BSD License 

import java.util.HashSet;

import java.util.Set;

public class Main {
    /**
     * Creates a list of the given type for the given elements.
     * 
     * @param <T>
     *            The type of the elements and the list.
     * @param elements
     *            The elements to add to the list.
     * @return The filled list.
     */
    public static <T> Set<T> createSet(final T... elements) {
        Set<T> coll = new HashSet<T>();
        if (elements != null) {
            for (int i = 0; i < elements.length; i++) {
                coll.add(elements[i]);
            }
        }
        return coll;
    }
}