Java List to String listToString(List inList, String delimeter)

Here you can find the source of listToString(List inList, String delimeter)

Description

listToString

License

Open Source License

Parameter

Parameter Description
inList a parameter
delimeter a parameter

Return

String

Declaration

public static String listToString(List inList, String delimeter) 

Method Source Code

//package com.java2s;
/**//from  w w  w .  ja  v a 2 s  .c o m
 * Copyright (c) 2015 SK holdings Co., Ltd. All rights reserved.
 * This software is the confidential and proprietary information of SK holdings.
 * 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 SK holdings.
 * (http://www.eclipse.org/legal/epl-v10.html)
 */

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

public class Main {
    /**
     * listToString
     *  
     * @param inList
     * @param delimeter
     * @return String
     */
    public static String listToString(List inList, String delimeter) {
        if (inList == null)
            return null;
        StringBuffer stBuf = new StringBuffer();
        for (Iterator itr = inList.iterator(); itr.hasNext();) {
            if (stBuf.length() > 0) {
                stBuf.append(delimeter);
            }
            stBuf.append((itr.next()).toString());
        }
        return stBuf.toString();
    }
}

Related

  1. listToString(final List list, final String separator)
  2. listToString(final List list)
  3. listToString(final List stringList)
  4. listToString(Iterable list)
  5. listToString(List a, String separator)
  6. listToString(List l)
  7. listToString(List l)
  8. listToString(List list)
  9. listToString(List list)