public static String join(final String[] strings,final String separator) throws IllegalArgumentException {
  if (strings == null) {
    throw new IllegalArgumentException("Input array 'strings' can't be null");
  }
  if (separator == null) {
    throw new IllegalArgumentException("separator can't be null");
  }
  StringJoiner joiner=new StringJoiner(separator);
  for (  String el : strings) {
    joiner.add(el);
  }
  return joiner.toString();
}

public static String join ( final String [ ] strings , final String separator ) throws IllegalArgumentException { if ( strings == null ) { throw new IllegalArgumentException ( "Input array 'strings' can't be null" ) ; } if ( separator == null ) { throw new IllegalArgumentException ( "separator can't be null" ) ; } StringJoiner joiner = new StringJoiner ( separator ) ; for ( String el : strings ) { joiner . add ( el ) ; } return joiner . toString ( ) ; }
join concatenates all the elements of the strings array into a single string . the separator string is placed between elements in the resulting string .
