Here you can find the source of join(List
public static String join(List<String> list, String conjunction)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static String join(List<String> list, String conjunction) { StringBuilder sb = new StringBuilder(); if (conjunction == null) { conjunction = ", "; }/* w w w . j av a2 s.c om*/ if (list != null && !list.isEmpty()) { for (String string : list) { sb.append(string).append(conjunction); } sb.setLength(sb.length() - conjunction.length()); } return sb.toString(); } }