Here you can find the source of joinList(List
public static <E extends CharSequence> String joinList(List<E> items)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { /**// w w w .j av a 2s .c om * joins a list of elements eg [a, b, c] into a string of the form: * "a", "b", "c" * * if the list is empty: returns "\"\"" (that is, a string containing two " characters, not an empty string) */ public static <E extends CharSequence> String joinList(List<E> items) { return "\"" + String.join("\", \"", items) + "\""; } }