Java Set Create toSet(String[] aStringArray)

Here you can find the source of toSet(String[] aStringArray)

Description

Converts a string array to a set of strings.

License

Open Source License

Parameter

Parameter Description
aStringArray a parameter

Declaration

public static Set<String> toSet(String[] aStringArray) 

Method Source Code

//package com.java2s;

import java.util.*;

public class Main {
    /**/* ww w  .j a  v  a  2 s.  c  o m*/
     * Converts a string array to a set of strings.
     *
     * @param aStringArray
     */
    public static Set<String> toSet(String[] aStringArray) {
        Set<String> set = new LinkedHashSet<>();
        if (aStringArray != null) {
            Collections.addAll(set, aStringArray);
        }
        return set;
    }
}

Related

  1. asSet(T... values)
  2. toSet(Iterable things)
  3. toSet(Iterable items)
  4. toSet(Object[] someElements)
  5. toSet(Set set)
  6. toSet(T... objects)
  7. unmodifiableSet(final Set s, final boolean newSet, final boolean emptyAsNull)