Java HashSet Create createHashSet(T... arr)

Here you can find the source of createHashSet(T... arr)

Description

create Hash Set

License

Apache License

Declaration

public static <T> Set<T> createHashSet(T... arr) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    public static <T> Set<T> createHashSet(T... arr) {
        int size = arr == null ? 0 : arr.length;
        Set<T> set = new HashSet<T>(size);
        if (arr != null && arr.length > 0) {
            Collections.addAll(set, arr);
        }//  w w w.j  a va  2  s  .c om
        return set;
    }
}

Related

  1. asHashSet(@SuppressWarnings("unchecked") T... elements)
  2. asHashSet(Set set)
  3. asHashSet(T... elements)
  4. convertHashSetIntoArray(HashSet cdsidsSet)
  5. hashSet()
  6. hashSet()
  7. hashset_to_int_array(Set hs)
  8. hashSetFromArray(final T[] objs)