Here you can find the source of join(Iterable collection)
join(null) = ""; join({}) = ""; join({a,b}) = "a,b";
Parameter | Description |
---|---|
collection | a parameter |
public static String join(Iterable collection)
//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); } }