Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.Collections;
import java.util.HashSet;

import java.util.Set;

public class Main {
    /**
     * Turns a list of vararg parameters into a set.
     *
     * @param  ts  The vararg parameters.
     * @param  <T> The type of the parameters.
     *
     * @return A set created by adding the parameters in the order presented into a set.
     */
    public static <T> Set<T> paramsToSet(T... ts) {
        Set<T> result = new HashSet<>();

        Collections.addAll(result, ts);

        return result;
    }
}