public static <E> String listAsString(List<E> list, String separator) {

        StringBuffer string = new StringBuffer(128);
        Iterator<E> it = list.iterator();
        while (it.hasNext()) {
            string.append(it.next());
            if (it.hasNext()) {
                string.append(separator);
            }
        }
        return string.toString();
    }
public static < E > String listAsString ( List < E > list , String separator ) { StringBuffer string = new StringBuffer ( 128 ) ; Iterator < E > it = list . iterator ( ) ; while ( it . hasNext ( ) ) { string . append ( it . next ( ) ) ; if ( it . hasNext ( ) ) { string . append ( separator ) ; } } return string . toString ( ) ; }
Returns a string representation for the given list using the given separator.<p>

@param <E> type of list entries
@param list the list to write
@param separator the item separator string

@return the string representation for the given map