class Sets {

    public static <V> Set<V> set( Collection<V> collection ) {
        if (collection instanceof Set) {
            return (Set <V>) collection;
        }
        if (collection==null) {
            return Collections.EMPTY_SET;
        }
        return new LinkedHashSet<>( collection );
    }

}

class SetsTest {

     Class<String> string;

    @Test
    public void arrayConversion() {


        String[] arry = Arry.array("0", "1", "2", "3", "4");

        Set<String> set = set( 3, arry);

        puts(set("0", "1", "2").equals(set));
    }

}