Here you can find the source of joinToString(String sep, Iterable
private static String joinToString(String sep, Iterable<String> items)
//package com.java2s; //License from project: Open Source License import java.util.StringJoiner; public class Main { private static String joinToString(String sep, Iterable<String> items) { final StringJoiner j = new StringJoiner(sep); items.forEach(j::add);//from w w w . j a va 2 s .co m return j.toString(); } }