public static StringBuilder toStringBuilder ( Collection < ? extends Object > collection , String delimiter ) { StringBuilder sb = new StringBuilder ( collection . size ( ) * 20 ) ; for ( Iterator < ? extends Object > it = collection . iterator ( ) ; it . hasNext ( ) ; ) { Object cs = it . next ( ) ; sb . append ( cs ) ; if ( it . hasNext ( ) ) { sb . append ( delimiter ) ; } } return sb ; }
Transform a collection of objects to a delimited String .