Here you can find the source of toCommaDelimitedStringInQuotes(Collection c)
public static String toCommaDelimitedStringInQuotes(Collection c)
//package com.java2s; /*/* w ww . jav a 2 s . c o m*/ * Copyright (c) 2016 Vivid Solutions. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v. 1.0 which accompanies this distribution. * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html * and the Eclipse Distribution License is available at * * http://www.eclipse.org/org/documents/edl-v10.php. */ import java.util.Collection; import java.util.Iterator; public class Main { /** * Returns the elements of c separated by commas and enclosed in * single-quotes */ public static String toCommaDelimitedStringInQuotes(Collection c) { StringBuffer result = new StringBuffer(); for (Iterator i = c.iterator(); i.hasNext();) { Object o = i.next(); result.append(",'" + o.toString() + "'"); } return result.substring(1); } }