Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.HashSet;

import java.util.List;

import java.util.Set;

public class Main {
    /**
     * <p>Turn source list to Set</p>
     * @param list source list
     * @return
     */
    public static <T extends Object> Set<T> turnListToSet(List<T> list) {
        Set set = new HashSet<T>();
        if (list != null) {
            for (T obj : list) {
                set.add(obj);
            }
        }
        return set;
    }
}