Java examples for java.util:Set Creation
Add a varargs list of items into a set.
//package com.java2s; import java.util.Set; public class Main { public static final <T, U extends T> Set<T> addToSet(Set<T> set, U... items) {/* w ww . ja v a2s.co m*/ if (set != null && items != null) { for (int i = 0; i < items.length; i++) { set.add(items[i]); } } return set; } }