Here you can find the source of join(Iterable extends CharSequence> iterable, String delimiter)
static String join(Iterable<? extends CharSequence> iterable, String delimiter)
//package com.java2s; //License from project: Open Source License import java.util.Iterator; public class Main { static String join(Iterable<? extends CharSequence> iterable, String delimiter) { Iterator<? extends CharSequence> it = iterable.iterator(); if (!it.hasNext()) return ""; StringBuilder sb = new StringBuilder(it.next()); while (it.hasNext()) { sb.append(delimiter).append(it.next()); }//ww w . j av a 2 s.c o m return sb.toString(); } }