src/main/java/com/tri/persistence/jpql/utils/StringUtils.java
public static String join(final String[] list) {

		// zero, empty or one element
		if (list == null) {
			return null;
		} else if (list.length == 0) {
			return "";
		} else if (list.length == 1) {
			return list[0];
		}

		// two or more elements
		final StringBuilder builder = new StringBuilder();
		for (String item : list) {
			if (builder.length() > 0) {
				builder.append(", ");
			}
			builder.append(item);
		}
		return builder.toString();

	}
public static String join(final String[] list) {

		// zero, empty or one element
		if (list == null) {
			return null;
		} else if (list.length == 0) {
			return "";
		} else if (list.length == 1) {
			return list[0];
		}

		// two or more elements
		final StringBuilder builder = new StringBuilder();
		for (String item : list) {
			if (builder.length() > 0) {
				builder.append(", ");
			}
			builder.append(item);
		}
		return builder.toString();

	}
public static String join ( final String [ ] list ) { // zero, empty or one element if ( list == null ) { return null ; } else if ( list . length == 0 ) { return "" ; } else if ( list . length == 1 ) { return list [ 0 ] ; } // two or more elements final StringBuilder builder = new StringBuilder ( ) ; for ( String item : list ) { if ( builder . length ( ) > 0 ) { builder . append ( ", " ) ; } builder . append ( item ) ; } return builder . toString ( ) ; }
Joins items of a text array, separating items by comma.

@param list
list of text items
@return joined list
Joins items of a text array separating items by comma .