Possible Duplicates:
What’s the best way to build a string of delimited items in Java?
Java: convert List<String> to a join()d string
In Java, given a collection, getting the iterator and doing a separate case for the first (or last) element and the rest to get a comma separated string seems quite dull, is there something like str.join
in Python?
Extra clarification for avoiding it being closed as duplicate: I'd rather not use external libraries like Apache Commons.
Thanks!