Java tutorial
//package com.java2s; import java.util.Collection; public class Main { public static String collectionJoinElements(Collection collection, String split) { StringBuilder builder = new StringBuilder(); int count = 0; for (Object object : collection) { builder.append(String.valueOf(object)); count++; if (count < collection.size()) { builder.append(split); } } return builder.toString(); } }