Java tutorial
//package com.java2s; import java.util.HashSet; import java.util.List; import java.util.Set; public class Main { /** * @param <T> * @param list * @return list */ public static <T> Set<T> list2Set(List<T> list) { Set<T> set = new HashSet<T>(); for (T t : list) { set.add(t); } return set; } }