public static String joinBySeparator ( List < String > items , String separator ) { int size = items . size ( ) ; if ( size == 0 ) { return "" ; } StringBuilder sb = new StringBuilder ( items . get ( 0 ) ) ; for ( int i = 1 ; i < size ; i ++ ) { sb . append ( separator ) . append ( items . get ( i ) ) ; } return sb . toString ( ) ; }
Join a list of strings by string .