Use following sample code to quick convert List to String with concatenation, power of StringUtil (apache ;))
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
public class Test {
public static void main(String[] args) {
List a = new ArrayList();
a.add("tom");
a.add("jerry");
a.add("fun");
String s = StringUtils.join(a.toArray(),",");
System.out.println(s);
}
}
Out Put : tom,jerry,fun
Cheers,
Kapil
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
public class Test {
public static void main(String[] args) {
List a = new ArrayList();
a.add("tom");
a.add("jerry");
a.add("fun");
String s = StringUtils.join(a.toArray(),",");
System.out.println(s);
}
}
Out Put : tom,jerry,fun
Cheers,
Kapil