Here you can find the source of join(Iterable
Parameter | Description |
---|---|
strings | - the string collection |
public static String join(Iterable<String> strings)
//package com.java2s; public class Main { /**/*from w w w. jav a 2s. co m*/ * make a comma seperated string out a passed list/set of strings * * @param strings - the string collection * @return the comma seperated string */ public static String join(Iterable<String> strings) { StringBuilder builder = new StringBuilder(); for (String s : strings) { builder.append(s).append(", "); } String result = builder.toString(); return result.substring(1, result.length() - 2); } }