Java Utililty Methods Array to Set

List of utility methods to do Array to Set

  1. HOME
  2. Java
  3. A
  4. Array to Set

Description

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

Method

Set arrayToSet(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;
Set arrayToSet(Object[] in)
{ method
Set ret = new HashSet();
for (int i = 0; i < in.length; i++)
 ret.add(in[i]);
return (ret);
Set toSet(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;
...
Set toSet(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);
Set translateToSet(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);

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