Here you can find the source of joinStr(CharSequence glue, Iterable extends CharSequence> parts)
public static String joinStr(CharSequence glue, Iterable<? extends CharSequence> parts)
//package com.java2s; //License from project: LGPL import java.util.Iterator; public class Main { public static String joinStr(CharSequence glue, Iterable<? extends CharSequence> parts) { return joinStr(glue, parts.iterator()); }/*from ww w. j a v a 2 s . c o m*/ public static String joinStr(CharSequence glue, Iterator<? extends CharSequence> parts) { StringBuilder sb = new StringBuilder(); boolean isFirst = true; if (parts.hasNext()) { sb.append(parts.next()); } while (parts.hasNext()) { sb.append(glue); sb.append(parts.next()); } return sb.toString(); } }