Here you can find the source of joinList(List
private static String joinList(List<String> list, String glue)
//package com.java2s; //License from project: Apache License import java.util.Iterator; import java.util.List; public class Main { private static String joinList(List<String> list, String glue) { Iterator<String> i = list.iterator(); if (i.hasNext() == false) { return ""; }// ww w .j a v a 2s . c om StringBuffer res = new StringBuffer(); res.append(i.next()); while (i.hasNext()) { res.append(glue + i.next()); } return res.toString(); } }