src/main/java/com/ve/cxe/commons/util/StringUtils.java
/**
     * <p>
     * Joins the elements of the provided {@code Iterator} into a single String
     * containing the provided elements.</p>
     * <p/>
     * <p>
     * No delimiter is added before or after the list. A {@code null} separator
     * is the same as an empty String ("").</p>
     * <p/>
     * <p>
     * See the examples here: {join(Object[], String)}. </p>
     *
     * @param iterator  the {@code Iterator} of values to join together, may be
     *                  null
     * @param separator the separator character to use, null treated as ""
     * @return the joined String, {@code null} if null iterator input
     */

Joins the elements of the provided  Iterator into a single String
containing the provided elements.


No delimiter is added before or after the list. A  null separator
is the same as an empty String ("").


See the examples here: {join(Object[], String)}.

@param iterator  the  Iterator of values to join together, may be
null
@param separator the separator character to use, null treated as ""
@return the joined String,  null if null iterator input
Joins the elements of the provided Iterator into a single String containing the provided elements . No delimiter is added before or after the list . A null separator is the same as an empty String ( " " ) . See the examples here : { join ( Object [] String ) } . @param iterator the Iterator of values to join together may be null @param separator the separator character to use null treated as " " @return the joined String null if null iterator input
public static String join(Iterator<?> iterator, String separator) {
        if (iterator == null) {
            return null;
        }
        if (separator == null) {
            separator = EMPTY_STRING;
        }
        if (!iterator.hasNext()) {
            return EMPTY_STRING;
        }
        Object first = iterator.next();
        if (!iterator.hasNext()) {
            return toString(first);
        }
        StringBuilder buf = new StringBuilder(); 
        if (first != null) {
            buf.append(first);
        }
        while (iterator.hasNext()) {
            buf.append(separator);
            Object obj = iterator.next();
            if (obj != null) {
                buf.append(obj);
            }
        }
        return buf.toString();
    }
public static String join ( Iterator < ? > iterator , String separator ) { if ( iterator == null ) { return null ; } if ( separator == null ) { separator = EMPTY_STRING ; } if ( ! iterator . hasNext ( ) ) { return EMPTY_STRING ; } Object first = iterator . next ( ) ; if ( ! iterator . hasNext ( ) ) { return toString ( first ) ; } StringBuilder buf = new StringBuilder ( ) ; if ( first != null ) { buf . append ( first ) ; } while ( iterator . hasNext ( ) ) { buf . append ( separator ) ; Object obj = iterator . next ( ) ; if ( obj != null ) { buf . append ( obj ) ; } } return buf . toString ( ) ; }
<p>
 Joins the elements of the provided {@code Iterator} into a single String
 containing the provided elements.</p>
 <p/>
 <p>
 No delimiter is added before or after the list.
<p > Joins the elements of the provided { @code Iterator } into a single String containing the provided elements . < / p > <p / > <p > No delimiter is added before or after the list .
// handle null, zero and one elements before building a buffer // two or more elements // Java default is 16, probably too small