Java List Concatenate concatenateList(List values)

Here you can find the source of concatenateList(List values)

Description

Concatenates a bunch of header values, seperating them with a comma.

License

Open Source License

Parameter

Parameter Description
values List of header values.

Return

String of all headers, with commas.

Declaration

private static String concatenateList(List values) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {
    /**/*from w  w w. j ava2  s  . co  m*/
     * Concatenates a bunch of header values, seperating them with a comma.
     * @param values List of header values.
     * @return String of all headers, with commas.
     */
    private static String concatenateList(List values) {
        StringBuffer buf = new StringBuffer();
        for (int i = 0, size = values.size(); i < size; ++i) {
            buf.append(((String) values.get(i)).replaceAll("\n", "").trim());
            if (i != (size - 1)) {
                buf.append(",");
            }
        }
        return buf.toString();
    }
}

Related

  1. concatenate(List contents, String separator)
  2. concatenate(List... lists)
  3. concatenate(String[] selectors, List lessExtends)
  4. concatenateFileContent(List fileContents)
  5. ConcatenateInt(List arrays)
  6. concatenateList(List list, String separator)
  7. concatenateListOfStrings(List list, String separator)
  8. concatenateLists(List... lists)
  9. concatenateParameters(List parameters)