Here you can find the source of joinStrings(List aList, String aString)
public static String joinStrings(List aList, String aString)
//package com.java2s; import java.util.*; public class Main { /**//from w w w .ja va2 s .com * Returns a string by concatenating strings in given list separated by given string. */ public static String joinStrings(List aList, String aString) { StringBuffer sb = new StringBuffer(); for (int i = 0, iMax = aList.size(); i < iMax; i++) sb.append(i == 0 ? "" : aString).append(aList.get(i)); return sb.toString(); } /** * Returns the size of a list (accepts null list). */ public static int size(List aList) { return aList == null ? 0 : aList.size(); } /** * Returns the object at the given index (returns null object for null list or invalid index). */ public static <T> T get(List<T> aList, int anIndex) { return aList == null || anIndex < 0 || anIndex >= aList.size() ? null : aList.get(anIndex); } }