List of utility methods to do Set Create
Set | asSet(T... elements) as Set Set<T> toReturn = new HashSet<>(); toReturn.addAll(Arrays.asList(elements)); return toReturn; |
Set | asSet(T... elements) as Set return asLinkedSet(elements);
|
Set | asSet(T... elements) Creates a java.util.Set with the given elements. final Set<T> resultSet = new LinkedHashSet<T>(); addAll(resultSet, elements); return resultSet; |
Set | asSet(T... items) as Set Set<T> set = new LinkedHashSet<T>(); Collections.addAll(set, items); return set; |
Set | asSet(T... ts) as Set Set<T> set = new HashSet<>(getInitialCapacityFromExpectedSize(ts.length)); Collections.addAll(set, ts); return set; |
Set | asSet(T... ts) Returns an unmodifiable set containing the given elements. if (ts == null) { return null; } else if (ts.length == 0) { return Collections.emptySet(); } else { Set<T> set = new HashSet<T>(ts.length); Collections.addAll(set, ts); return Collections.unmodifiableSet(set); ... |
Set | asSet(T... values) as Set return new HashSet<>(asList(values)); |
Set | asSet(T... values) as Set return new HashSet<>(Arrays.asList(values)); |
Set | toSet(Iterable extends T> things) to Set if (things == null) { return new HashSet<T>(0); if (things instanceof Set) { @SuppressWarnings("unchecked") Set<T> castThings = (Set<T>) things; return castThings; Set<T> set = new LinkedHashSet<T>(); for (T thing : things) { set.add(thing); return set; |
Set | toSet(Iterable to Set return toSet(items.iterator());
|