Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.Set;

public class Main {
    public static <C extends Set<T>, T> Set<T> toSet(T[] array, Class<C> clazz) {
        try {
            Set<T> set = clazz.newInstance();
            for (T o : array) {
                set.add(o);
            }
            return set;
        } catch (Exception e) {
            return null;
        }
    }
}