Here you can find the source of joinEmptyItemIncluded(Collection
public static String joinEmptyItemIncluded(Collection<String> stringCollection, String delimiter)
//package com.java2s; /*L/* w ww .j a v a 2 s . co m*/ * Copyright SAIC * Copyright SAIC-Frederick * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/cananolab/LICENSE.txt for details. */ import java.util.Collection; import java.util.Iterator; public class Main { public static String joinEmptyItemIncluded(Collection<String> stringCollection, String delimiter) { StringBuffer buffer = new StringBuffer(); if (stringCollection == null || stringCollection.isEmpty()) { return ""; } Iterator iter = stringCollection.iterator(); while (iter.hasNext()) { String item = (String) iter.next(); if (item == null) item = ""; buffer.append(item); if (iter.hasNext()) { buffer.append(delimiter); } } return buffer.toString(); } /** * Return true for Null or empty string, false otherwise. */ public static boolean isEmpty(String str) { return (str == null || str.trim().length() == 0); } }