Here you can find the source of join(Collection
public static <T> String join(Collection<T> values, String join)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.util.Collection; public class Main { public static <T> String join(Collection<T> values, String join) { StringBuilder result = new StringBuilder(); String delim = ""; for (T value : values) { result.append(delim);/*from ww w .j a v a 2 s.c o m*/ result.append(value == null ? "null" : value.toString()); delim = join; } return result.toString(); } }