Java Utililty Methods Array to Set

List of utility methods to do Array to Set

Description

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

Method

SetarrayToSet(final T[] array)
Converts the specified array to a set.
if (null == array) {
    return Collections.emptySet();
final Set<T> ret = new HashSet<T>();
for (int i = 0; i < array.length; i++) {
    final T object = array[i];
    ret.add(object);
return ret;
SetarrayToSet(Object[] in)
{ method
Set ret = new HashSet();
for (int i = 0; i < in.length; i++)
    ret.add(in[i]);
return (ret);
SettoSet(final TYPE[] array)
to Set
if (array == null) {
    return Collections.emptySet();
final Set<TYPE> result = new HashSet<TYPE>();
for (int i = 0; i < array.length; i++) {
    result.add(array[i]);
return result;
...
SettoSet(T[] array)
Converts an array to a Set .
final Set<T> result = new HashSet<T>();
for (final T element : array) {
    result.add(element);
return Collections.unmodifiableSet(result);
SettranslateToSet(T[] array)
Creates new Set from passed array instance
List<T> collection;
if (valid(array)) {
    collection = Arrays.asList(array);
} else {
    collection = null;
return translateToSet(collection);