public static StringArray toArray(JCas jCas,Collection<String> collection){
  if (collection == null || collection.isEmpty()) {
    return new StringArray(jCas,0);
  }
 else {
    int size=collection.size();
    StringArray array=new StringArray(jCas,size);
    array.copyFromArray(collection.toArray(new String[size]),0,0,size);
    return array;
  }
}

public static StringArray toArray ( JCas jCas , Collection < String > collection ) { if ( collection == null || collection . isEmpty ( ) ) { return new StringArray ( jCas , 0 ) ; } else { int size = collection . size ( ) ; StringArray array = new StringArray ( jCas , size ) ; array . copyFromArray ( collection . toArray ( new String [ size ] ) , 0 , 0 , size ) ; return array ; } }
create a new stringarray from a collection of strings .
