public static String join ( List < String > parts , String separator ) { Iterator < String > it = parts . iterator ( ) ; StringBuilder builder = new StringBuilder ( ) ; while ( it . hasNext ( ) ) { String part = it . next ( ) ; builder . append ( part ) ; if ( it . hasNext ( ) ) { builder . append ( separator ) ; } } return builder . toString ( ) ; }
Joins a list of strings using the specified separator .