Here you can find the source of getCommaList(List
Vector
of String
s.
public static String getCommaList(List<String> V)
//package com.java2s; /**//from www. ja va 2 s .c om * Javatator 0.1 - multi-database admin tool * * Copyright (C) 2000 Jason Davies. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * If you want to help or want to report any bugs, please email me: * jason@javaphilia.com * */ import java.util.List; public class Main { /** * Gets comma-separated list from a <code>Vector</code> of <code>String</code>s. */ public static String getCommaList(List<String> V) { StringBuffer SB = new StringBuffer(); int size = V.size(); for (int i = 0; i < size; i++) { if (SB.length() > 0) SB.append(','); SB.append(V.get(i)); } return SB.toString(); } }