Android List to String Convert listStrToString(List inputList)

Here you can find the source of listStrToString(List inputList)

Description

list -> String list:100,200,300 - > string:100,200,300

Parameter

Parameter Description
inputList a parameter

Declaration

public static String listStrToString(List<String> inputList) 

Method Source Code

//package com.java2s;

import java.util.List;

public class Main {
    private static final String COMMA = ",";

    /**/* w w  w.j ava2 s  .  c  o m*/
     * list -> String
     * list:100,200,300 - >  string:100,200,300
     * 
     * @param inputList
     * @return
     */
    public static String listStrToString(List<String> inputList) {

        if (null == inputList || inputList.isEmpty()) {
            return "";
        }

        StringBuffer sb = new StringBuffer();

        for (String input : inputList) {
            sb.append(input);
            sb.append(COMMA);
        }
        sb.setLength(sb.length() - 1);

        return sb.toString();
    }
}

Related

  1. listLongToString(List inputList)
  2. listToString(List list)
  3. convertStringArrayToString( List stringList, String seperator)
  4. listToString(List list, String delimiter)
  5. getCommaDelimitedString(List input)