Java Set Create asSet(T... a)

Here you can find the source of asSet(T... a)

Description

as Set

License

Apache License

Declaration

public static <T> Set<T> asSet(T... a) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    public static <T> Set<T> asSet(T... a) {
        if (a.length > 1)
            return new HashSet<T>(Arrays.<T> asList(a));
        else//from   w  w w .  java2 s .c  om
            return Collections.singleton(a[0]);
    }
}

Related

  1. asSet(Iterable iteratable)
  2. asSet(K... values)
  3. asSet(Object[] array)
  4. asSet(Optional opt)
  5. asSet(T... a)
  6. asSet(T... args)
  7. asSet(T... array)
  8. asSet(T... array)
  9. asSet(T... array)