String (List<String> strs) { StringBuilder sb = new StringBuilder(); sb.append("{"); // before String separator = ""; for <caret> (String str : strs) { sb.append(separator); // inside sb.append(str); separator = ","; } sb.append("}"); // after return sb.toString(); }