Here you can find the source of joinNiceString(List
public static String joinNiceString(List<String> strings)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static String joinNiceString(List<String> strings) { StringBuilder stringbuilder = new StringBuilder(); int i = 0; for (String s : strings) { if (i > 0) { if (i == strings.size() - 1) { stringbuilder.append(" and "); } else { stringbuilder.append(", "); }/*from www . ja va 2 s.com*/ } stringbuilder.append(s); i++; } return stringbuilder.toString(); } }