Java List to String listToString(List queryList, String delimitedString)

Here you can find the source of listToString(List queryList, String delimitedString)

Description

List to string.

License

Open Source License

Parameter

Parameter Description
queryList the query list
delimitedString the delimited string

Return

the string

Declaration

public static String listToString(List<String> queryList, String delimitedString) 

Method Source Code


//package com.java2s;
/*/*from www  .  j  a  v a2  s . c o m*/
 * StringUtil.java
 * Copyright (c) 2013, EcoFactor, All Rights Reserved.
 *
 * This software is the confidential and proprietary information of EcoFactor
 * ("Confidential Information"). You shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement you entered into with
 * EcoFactor.
 */

import java.util.Iterator;
import java.util.List;

public class Main {
    /**
     * List to string.
     * @param queryList the query list
     * @param delimitedString the delimited string
     * @return the string
     */
    public static String listToString(List<String> queryList, String delimitedString) {

        String newString = "";
        for (Iterator<String> it = queryList.iterator(); it.hasNext();) {
            newString += it.next();
            if (it.hasNext()) {
                newString += delimitedString;
            }
        }
        return newString;
    }
}

Related

  1. listToString(List list, String separator)
  2. listToString(List list, String separator)
  3. listToString(List list, String split)
  4. listToString(List params, String sepator)
  5. listToString(List pListToConvert)
  6. listToString(List s, String separator)
  7. listToString(List segs, String splitter)
  8. listToString(List stringList)
  9. listToString(List tags)