Here you can find the source of joinStrings(String joiner, List
public static <T> String joinStrings(String joiner, List<T> objects)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static <T> String joinStrings(String joiner, List<T> objects, boolean wantBlanks) { StringBuilder result = new StringBuilder(); boolean first = true; for (T object : objects) { String piece = object.toString(); if (piece.equals("") && !wantBlanks) { continue; }/*from w ww .j a v a2 s .c o m*/ if (first) { first = false; } else { result.append(joiner); } result.append(piece); } return result.toString(); } public static <T> String joinStrings(String joiner, List<T> objects) { return joinStrings(joiner, objects, false); } }