Here you can find the source of implode(String glue, ArrayList
public static String implode(String glue, ArrayList<String> array)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { public static String implode(String glue, ArrayList<String> array) { return implode(glue, array.stream().toArray(String[]::new)); }//from w ww . j a va 2s . c om public static String implode(String glue, String[] array) { StringBuilder sb = new StringBuilder(); boolean f = true; for (String a : array) { if (f) { f = false; } else { sb.append(glue); } sb.append(a); } return sb.toString(); } }