public String join(List<String> list) {

        if (list == null) {
            return null;
        }

        StringBuilder sb = new StringBuilder();
        boolean first = true;
        for (String s : list) {

            if (s == null) {
                if (convertEmptyToNull) {
                    s = "";
                } else {
                    throw new IllegalArgumentException("StringListFlattener does not support null strings in the list. Consider calling setConvertEmptyToNull(true).");
                }
            }

            if (!first) {
                sb.append(separator);
            }

            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                if (c == escapeChar || c == separator) {
                    sb.append(escapeChar);
                }
                sb.append(c);
            }

            first = false;
        }
        return sb.toString();
    }
public String join ( List < String > list ) { if ( list == null ) { return null ; } StringBuilder sb = new StringBuilder ( ) ; boolean first = true ; for ( String s : list ) { if ( s == null ) { if ( convertEmptyToNull ) { s = "" ; } else { throw new IllegalArgumentException ( "StringListFlattener does not support null strings in the list. Consider calling setConvertEmptyToNull(true)." ) ; } } if ( ! first ) { sb . append ( separator ) ; } for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( c == escapeChar || c == separator ) { sb . append ( escapeChar ) ; } sb . append ( c ) ; } first = false ; } return sb . toString ( ) ; }
Joins the given list into a single string.