Android Iterable Join join(Iterable collection)

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

Description

join collection to string, separator is #DEFAULT_JOIN_SEPARATOR
 join(null)      =   ""; join({})        =   ""; join({a,b})     =   "a,b"; 

Parameter

Parameter Description
collection a parameter

Return

join collection to string, separator is . if collection is empty, return ""

Declaration

public static String join(Iterable collection) 

Method Source Code

//package com.java2s;

import android.text.TextUtils;

public class Main {
    /** default join separator **/
    public static final CharSequence DEFAULT_JOIN_SEPARATOR = ",";

    /**/*from   w w w. j  a v a 2 s.com*/
     * join collection to string, separator is {@link #DEFAULT_JOIN_SEPARATOR}
     * 
     * <pre>
     * join(null)      =   "";
     * join({})        =   "";
     * join({a,b})     =   "a,b";
     * </pre>
     * 
     * @param collection
     * @return join collection to string, separator is {@link #DEFAULT_JOIN_SEPARATOR}. if collection is empty, return
     *         ""
     */
    public static String join(Iterable collection) {
        return collection == null ? "" : TextUtils.join(
                DEFAULT_JOIN_SEPARATOR, collection);
    }
}

Related

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