1. groovy list with primitive data type, just use "Join" like:
def numbers = [0, 1, 2, 3, 4, 5] as Integer[] assert '012345' == numbers.join() assert '0 x 1 x 2 x 3 x 4 x 5' == numbers.join(' x ') assert '0 1 2 3 4 5' == numbers.join(' ') |
2. groovy list with object as type, like
class CurrencyType implements Serializable{ int id String code String currency String toString() { "id:$id, code:$code,currency:$currency" } } def currenciesList = [ ] println currenciesList.collect{"${it.toString()}"}.join("\n") |