List of utility methods to do HashSet Create
int | select(HashSet select Random R = new Random(); int r = R.nextInt(S.size()); int i = 0; for (int e : S) { i++; if (i == r) { return e; return 0; |
HashSet | stringArrayToHashset(String[] strings) A function for converting string arrays to HashSets of strings, provided as a convenience for preparing string arrays for TNRS. HashSet<String> stringSet = new HashSet<String>(); for (int i = 0; i < strings.length; i++) { stringSet.add(strings[i]); return stringSet; |
HashSet | toHashSet(Object[] array) to Hash Set HashSet result = new HashSet(); for (int i = array.length - 1; i >= 0; i--) result.add(array[i]); return result; |
Set | toHashSet(Set to Hash Set Set<T> rslt = new HashSet<>(); rslt.addAll(inp); return rslt; |