Java tutorial
//package com.java2s; import java.util.List; import java.util.Set; public class Main { public static String[] toArray(List<String> list) { return list.toArray(new String[list.size()]); } public static String[] toArray(Set<String> set) { return set.toArray(new String[set.size()]); } }