public static String join ( CharSequence separator , Iterable < ? > strings ) { Iterator < ? > i = strings . iterator ( ) ; if ( ! i . hasNext ( ) ) { return "" ; } StringBuilder sb = new StringBuilder ( i . next ( ) . toString ( ) ) ; while ( i . hasNext ( ) ) { sb . append ( separator ) ; sb . append ( i . next ( ) . toString ( ) ) ; } return sb . toString ( ) ; }
Concatenates strings using a separator .