Android Iterable Join join(Iterable strings)

Here you can find the source of join(Iterable strings)

Description

make a comma seperated string out a passed list/set of strings

Parameter

Parameter Description
strings - the string collection

Return

the comma seperated string

Declaration

public static String join(Iterable<String> strings) 

Method Source Code

//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);
    }
}

Related

  1. join(Iterable collection)
  2. join(Iterable parts, String delimiter)
  3. join(Iterable s, CharSequence delimiter)
  4. join(Iterable iterable)