Here you can find the source of joinString(List> objs, String separator)
public static String joinString(List<?> objs, String separator)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.util.List; public class Main { /**/*from w ww . j a v a 2s.co m*/ * Create a string for a list of objects, with a specified separator, * e.g. ["a","b","c"], "," -> "a,b,c" */ public static String joinString(List<?> objs, String separator) { String s = ""; boolean first = true; for (Object obj : objs) { if (first) { first = false; } else { s += separator; } s += obj.toString(); } return s; } /** * Create a string for an array of objects, with a specified separator, * e.g. ["a","b","c"], "," -> "a,b,c" */ public static String joinString(Object[] objs, String separator) { String s = ""; boolean first = true; for (Object obj : objs) { if (first) { first = false; } else { s += separator; } s += obj.toString(); } return s; } }