Java Set Create asSet(T... elements)

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

Description

as Set

License

Apache License

Declaration

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

Method Source Code


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

import java.util.*;

public class Main {
    public static <T> Set<T> asSet(T... elements) {
        Set<T> toReturn = new HashSet<>();
        toReturn.addAll(Arrays.asList(elements));
        return toReturn;
    }//from   ww w. j av a 2s .  co  m

    public static <T> List<T> asList(T... elements) {
        List<T> toReturn = new ArrayList<>();
        toReturn.addAll(Arrays.asList(elements));
        return toReturn;
    }
}

Related

  1. asSet(T... args)
  2. asSet(T... array)
  3. asSet(T... array)
  4. asSet(T... array)
  5. asSet(T... element)
  6. asSet(T... elements)
  7. asSet(T... elements)
  8. asSet(T... items)
  9. asSet(T... ts)