Java Comma Separated List getCommaList(List V)

Here you can find the source of getCommaList(List V)

Description

Gets comma-separated list from a Vector of Strings.

License

Open Source License

Declaration

public static String getCommaList(List<String> V) 

Method Source Code

//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();
    }
}

Related

  1. convertToStringList(String valuesCommaSeparated)
  2. extractCommaItems(List list, String tags)
  3. extractCommandsFromLine(final String line, final String delimiter, final StringBuilder bufferedCommand, final List extractedCommands)
  4. formatCommand(List arguments)
  5. getAsCommaDelimitedString(List coll)
  6. getCommandLine(List command)
  7. getCommandLineOptionInt(List args, String param, int defaultValue)
  8. getCommandStr(List commandList)
  9. getCommaSeparatedList(Collection stringValues)