Here you can find the source of joinCol(Collection lst, String delim)
Parameter | Description |
---|---|
lst | a parameter |
delim | a parameter |
private static String joinCol(Collection lst, String delim)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { /**// www.jav a2 s .com * split into separate method so we don't get any accidental recursion * between join(list) and join(collection). * @param lst * @param delim * @return */ private static String joinCol(Collection lst, String delim) { StringBuilder builder = new StringBuilder(); for (Object obj : lst) { if (obj != null) builder.append(obj.toString()); builder.append(delim); } builder.delete(builder.length() - delim.length(), builder.length()); return builder.toString(); } }