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 .