Java tutorial
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static String listToString(List<String> weeks) { if (weeks == null || weeks.isEmpty()) { return ""; } StringBuffer result = new StringBuffer(); for (String week : weeks) { result.append(week).append(","); } if (result.length() != 0) { result.deleteCharAt(result.length() - 1); } return result.toString(); } }