private static String concatWithSeparator(Collection<String> words,String separator){
  StringBuilder wordList=new StringBuilder();
  for (  String word : words) {
    wordList.append(new String(word) + separator);
  }
  return new String(wordList.deleteCharAt(wordList.length() - 1));
}

private static String concatWithSeparator ( Collection < String > words , String separator ) { StringBuilder wordList = new StringBuilder ( ) ; for ( String word : words ) { wordList . append ( new String ( word ) + separator ) ; } return new String ( wordList . deleteCharAt ( wordList . length ( ) - 1 ) ) ; }
helper function to concatenate a list of strings with the supplied separator { " item " , " item3 " , " test " } - > " item , item3 , test "
