public static void join ( StringBuilder sb , Collection < ? > collection , String delimiter ) { if ( collection . isEmpty ( ) ) { return ; } Iterator < ? > it = collection . iterator ( ) ; sb . append ( it . next ( ) ) ; while ( it . hasNext ( ) ) { sb . append ( delimiter ) ; sb . append ( it . next ( ) ) ; } }
Joins the items in collection with a delimiter and appends the result to StringBuilder .