Java tutorial
//package com.java2s; import android.text.TextUtils; public class Main { /** default join separator **/ public static final CharSequence DEFAULT_JOIN_SEPARATOR = ","; /** * 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); } }