Java examples for java.util:Collection Join
Copy the given Collection into a String array.
//package com.java2s; import java.util.Collection; public class Main { public static void main(String[] argv) { Collection collection = java.util.Arrays.asList("asdf", "java2s.com"); System.out.println(java.util.Arrays .toString(toStringArray(collection))); }/* w ww.jav a 2 s . com*/ public static String[] toStringArray(Collection<String> collection) { if (collection == null) { return null; } return collection.toArray(new String[collection.size()]); } }