Here you can find the source of joinValues(Collection
public static String joinValues(Collection<String> values, String separator)
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { public static String joinValues(Collection<String> values, String separator) { StringBuilder builder = new StringBuilder(); boolean first = true; for (String value : values) { if (!first) { builder.append(separator); } else { first = false;//from ww w .j a v a 2 s .c o m } builder.append(value); } return builder.toString(); } }