Convert Array to string in Java/Groovy

Use the join method that Groovy addes to Collection

List l = [1,2,3,4,5,6]
assert l.join(',') == "1,2,3,4,5,6"

In groovy:

def myList = [1,2,3,4,5]
def asString = myList.join(", ")

Use join, e.g.,

tripIds.join(", ")

Unrelated, but if you just want to create a list of something from another list, you'd be better off doing something like a map or collect instead of manually creating a list and appending to it, which is less idiomatic, e.g. (untested),

def sql = Sql.newInstance("jdbc:mysql://localhost:3306/steer", "root", "", "com.mysql.jdbc.Driver")
def tripIds = sql.map { it.id }

Or if you only care about the resulting string,

def tripIds = sql.map { it.id }.join(", ")