Java convert a list to a csv string

Here’s an easy way to convert a list of Strings to a String containing csv values

<pre  class=”brush:java”>

StringUtils.join(list, ‘,’)

</pre>

To reverse conversion can be done by – csv to list

<pre  class=”brush:java”>

Arrays.asList(StringUtils.split(rs.getString(“a,b”), “,”))

</pre>