List of utility methods to do HashSet Create
HashSet | asHashSet(@SuppressWarnings("unchecked") T... elements) Create a hashed set from an array. HashSet<T> result = new HashSet<T>(); Collections.addAll(result, elements); return result; |
HashSet | asHashSet(Set as Hash Set if (HashSet.class.isInstance(set)) { return (HashSet<E>) set; } else { return new HashSet<E>(set); |
Set | asHashSet(T... elements) as Hash Set Set<T> set = new HashSet<T>(); Collections.addAll(set, elements); return set; |
String[] | convertHashSetIntoArray(HashSet Eliminate duplicate CDSIDs String[] cdsids = new String[cdsidsSet.size()]; if (cdsidsSet.size() > 0) { Iterator it = cdsidsSet.iterator(); int x = 0; while (it.hasNext()) { cdsids[x++] = (String) it.next(); return cdsids; |
Set | createHashSet(T... arr) create Hash Set int size = arr == null ? 0 : arr.length; Set<T> set = new HashSet<T>(size); if (arr != null && arr.length > 0) { Collections.addAll(set, arr); return set; |
HashSet | hashSet() hash Set return new HashSet<>(); |
Set | hashSet() Creates an empty HashSet instance. return new HashSet<T>(); |
int[] | hashset_to_int_array(Set hashsetinarray int array[] = new int[hs.size()]; Iterator<Integer> itr = hs.iterator(); int i = 0; while (itr.hasNext()) { array[i++] = Integer.parseInt(itr.next().toString()); return array; |
Set | hashSetFromArray(final T[] objs) hash Set From Array final Set<T> set = new HashSet<T>(); for (final T obj : objs) { set.add(obj); return set; |
Set | hashSetOf(T... elements) hash Set Of HashSet<T> set = new HashSet<>(); for (T element : elements) { set.add(element); return set; |