Java examples for java.util:List Operation
Turns a list of vararg parameters into a set.
//package com.java2s; import java.util.Collections; import java.util.HashSet; import java.util.Set; public class Main { /**//from w ww. j a v a 2s. com * 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; } }