Is there something like the following in Apache Common Lang
or Spring Utils
or do you write your own Util method for this?
List<String> list = new ArrayList<String>();
list.add("moo");
list.add("foo");
list.add("bar");
String enumeratedList = Util.enumerate(list, ", ");
assert enumeratedList == "moo, foo, bar";
I remember the use of implode
in php, this is what i search for java.
$array = array('lastname', 'email', 'phone');
$comma_separated = implode(",", $array);