Java Utililty Methods Set Create

List of utility methods to do Set Create

  1. HOME
  2. Java
  3. S
  4. Set Create

Description

The list of methods to do Set Create are organized into topic(s).

Method

Set asSet(Collection c)
as Set
return new LinkedHashSet<T>(c);
Set asSet(Collection c)
as Set
if (c instanceof Set) {
 return (Set<T>) c;
LinkedHashSet<T> set = new LinkedHashSet<T>(c);
return set;
HashSet asSet(Collection c)
as Set
HashSet<T> ret = new HashSet<T>();
ret.addAll(c);
return ret;
Set asSet(E... elements)
as Set
if (elements == null || elements.length == 0) {
 return Collections.emptySet();
LinkedHashSet<E> set = new LinkedHashSet<E>(elements.length * 4 / 3 + 1);
Collections.addAll(set, elements);
return set;
Set asSet(E... pEntities)
as Set
if (pEntities != null) {
 Set<E> entities = new HashSet<>();
 for (E entity : pEntities) {
 entities.add(entity);
 return entities;
return Collections.emptySet();
...
Set asSet(final E... elements)
Creates an immutable HashSet instance containing the given elements in unspecified order.
if (elements == null) {
 return new HashSet<>(0);
final Set<E> set = new HashSet<>(elements.length);
Collections.addAll(set, elements);
return Collections.unmodifiableSet(set);
Set asSet(final T t, final T... ts)
as Set
final Set<T> set = new HashSet<T>(ts.length + 1);
set.add(t);
Collections.addAll(set, ts);
return set;
Set asSet(final T... array)
Returns the specified array as a Set of elements.
Set<T> arraySet = new HashSet<T>(array.length);
Collections.addAll(arraySet, array);
return arraySet;
Set asSet(int... values)
as Set
Set<Integer> s = new HashSet<Integer>();
for (int v : values) {
 s.add(v);
return s;
Set asSet(Iterable iteratable)
as Set
final HashSet<T> set = new HashSet<>();
return asSet(iteratable, set);


AltStyle によって変換されたページ (->オリジナル) /