Here you can find the source of join(Collection extends Object> collection, String joinString)
public static String join(Collection<? extends Object> collection, String joinString)
//package com.java2s; //License from project: Apache License import java.util.Collection; import java.util.Iterator; public class Main { public static String join(Collection<? extends Object> collection, String joinString) {/*from w ww . j a v a 2s . co m*/ StringBuilder sb = new StringBuilder(); Iterator<? extends Object> iter = collection.iterator(); while (iter.hasNext()) { sb.append(iter.next()); if (iter.hasNext()) { sb.append(joinString); } } return sb.toString(); } }