Joining Items in a Collection

To join the items in a collection into a single String, use its join() function as shown below, passing the string you want to be used as the separator between list items.

def paths = ['/bin', '/usr/bin', '/usr/local/bin']
// Join the paths in the list, separating by a colon
def pathString = recipients.join(':')
The result will be the string:
/bin:/usr/bin:/usr/local/bin