List of utility methods to do Set Create
HashSet | asSet(K... values) as Set return new HashSet<K>(Arrays.asList(values)); |
Set | asSet(Object[] array) as Set if (array == null) { return null; Set result = new HashSet(array.length); for (int i = 0; i < array.length; i++) { result.add(array[i]); return result; ... |
Collection | asSet(Optional as Set if (opt.isPresent()) { return Collections.singleton(opt.get()); return Collections.emptySet(); |
Set | asSet(T... a) as Set return a != null ? new HashSet(Arrays.asList(a)) : Collections.emptySet(); |
Set | asSet(T... a) as Set if (a.length > 1) return new HashSet<T>(Arrays.<T>asList(a)); else return Collections.singleton(a[0]); |
Set | asSet(T... args) as Set return new HashSet<T>(Arrays.asList(args)); |
Set | asSet(T... array) as Set if (array == null) { return null; Set<T> set = new HashSet<T>(array.length * 2); for (T t : array) { set.add(t); return set; ... |
Set | asSet(T... array) Create a set from an array. Set<T> result = new HashSet<>(); Collections.addAll(result, array); return result; |
Set | asSet(T... array) This method works like Arrays#asList(Object[]) , but returns an instance of Set instead of a list final HashSet<T> set = new HashSet<T>(); Collections.addAll(set, array); return set; |
Set | asSet(T... element) as Set HashSet<T> elements = new HashSet<T>(element.length); Collections.addAll(elements, element); return elements; |