String stringJoinAndDecorate ( final List < String > list , final String sep , StringDecorator decorator ) { if ( decorator == null ) { decorator = new NothingDecorator ( ) ; } StringBuilder sb = new StringBuilder ( ) ; if ( list != null ) { boolean first = true ; for ( String argument : list ) { if ( ! first ) { sb . append ( sep ) ; } sb . append ( decorator . decorate ( argument ) ) ; first = false ; } } return sb . toString ( ) ; }
Join list and separate by sep each elements is decorate by decorator