Here you can find the source of join(final Collection
static String join(final Collection<String> toJoin)
//package com.java2s; /*/*from w ww .j a v a 2 s . c o m*/ * Copyright (c) 2007-2013 Sonatype, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ import java.util.Collection; import java.util.Iterator; public class Main { static String join(final Collection<String> toJoin) { if (toJoin == null) { return null; } final String separator = ","; final StringBuffer buf = new StringBuffer(256); final Iterator<String> iterator = toJoin.iterator(); while (iterator.hasNext()) { buf.append(iterator.next()); if (iterator.hasNext()) { buf.append(separator); } } return buf.toString(); } }