Convert Array as Set via List - Java java.util

Java examples for java.util:List Convert

Description

Convert Array as Set via List

Demo Code


//package com.java2s;

import java.util.Arrays;

import java.util.HashSet;

import java.util.Set;

public class Main {
    public static <T> Set<T> asSet(T... ts) {
        return new HashSet<T>(Arrays.asList(ts));
    }//from  ww w.j a v  a  2s  . c  o  m
}

Related Tutorials