Java Set Create asSet(T... array)

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

Description

as Set

License

Apache License

Declaration

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

Method Source Code

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

import java.util.*;

public class Main {
    public static <T> Set<T> asSet(T... array) {
        if (array == null) {
            return null;
        }//from w  w  w  . j  a v  a  2 s .c  om
        Set<T> set = new HashSet<T>(array.length * 2);
        for (T t : array) {
            set.add(t);
        }
        return set;
    }
}

Related

  1. asSet(Object[] array)
  2. asSet(Optional opt)
  3. asSet(T... a)
  4. asSet(T... a)
  5. asSet(T... args)
  6. asSet(T... array)
  7. asSet(T... array)
  8. asSet(T... element)
  9. asSet(T... elements)