Java Set Create asSet(T... a)

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

Description

as Set

License

Apache License

Declaration

@SuppressWarnings("unchecked")
    public static <T> Set<T> asSet(T... a) 

Method Source Code

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

import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;

import java.util.Set;

public class Main {
    @SuppressWarnings("unchecked")
    public static <T> Set<T> asSet(T... a) {
        return a != null ? new HashSet(Arrays.asList(a)) : Collections.emptySet();
    }//from   w  w w. ja  va 2  s. c  o  m
}

Related

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