Here you can find the source of concatenate(List
public static <T> String concatenate(List<T> contents, String separator)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static <T> String concatenate(List<T> contents, String separator) { if (contents == null || contents.isEmpty()) return null; String concatenation = ""; for (Object content : contents) { concatenation += content.toString() + separator; }/* ww w .jav a 2 s .c o m*/ return concatenation.substring(0, concatenation.length() - separator.length()); } }