25

Hi I am having a requirement where I need to convert List of Long datatype to comma separated String. Which would be the appropriate way. I have thought about using string builder or converting it to List<String> and then using StringUtils join to get a String.

I am looking for java 7 solution,Not using guava or java 8.

Jordi Castilla
  • 26,609
  • 8
  • 70
  • 109
user2375298
  • 1,001
  • 4
  • 15
  • 28

1 Answers1

35

You can try this:

StringUtils.join(mylist, ',');

See org.apache.commons.lang3.StringUtils.

risingTide
  • 1,754
  • 7
  • 31
  • 60
Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331