Here you can find the source of convertListToString(List
Parameter | Description |
---|---|
list | List |
delimiter | Delimiter |
estimatedLength | Estimated length (for performance reasons) |
public static String convertListToString(List<Object> list, char delimiter, int estimatedLength)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { /**// w w w.java2 s.co m * Converts a list to a string * * @param list * List * @param delimiter * Delimiter * @param estimatedLength * Estimated length (for performance reasons) * @return String */ public static String convertListToString(List<Object> list, char delimiter, int estimatedLength) { StringBuilder builder = new StringBuilder(estimatedLength); for (Object value : list) { if (builder.length() > 0) { builder.append(delimiter).append(" "); } builder.append(value); } return builder.toString(); } }