Android List to String Convert listLongToString(List inputList)

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

Description

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

Parameter

Parameter Description
inputList a parameter

Declaration

public static String listLongToString(List<Long> inputList) 

Method Source Code

//package com.java2s;

import java.util.List;

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

    /**//from   w  w  w  .  j av  a 2s.c  om
     * list -> String
     * list:100,200,300 - >  string:100,200,300
     * 
     * @param inputList
     * @return
     */
    public static String listLongToString(List<Long> inputList) {

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

        StringBuffer sb = new StringBuffer();

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

        return sb.toString();
    }
}

Related

  1. listStrToString(List inputList)
  2. listToString(List list)
  3. convertStringArrayToString( List stringList, String seperator)
  4. listToString(List list, String delimiter)