public static String[] toStringArray(Collection<String> collection){
  if (collection == null) {
    return null;
  }
  return collection.toArray(new String[collection.size()]);
}

public static String [ ] toStringArray ( Collection < String > collection ) { if ( collection == null ) { return null ; } return collection . toArray ( new String [ collection . size ( ) ] ) ; }
copy the given collection into a string array . the collection must contain string elements only .
