groovy append to list

To append an element to a list in Groovy, you can use the add() method. Here's an example:

def myList = [1, 2, 3] // define a list
myList.add(4) // append an element to the list

After executing this code, the myList will be [1, 2, 3, 4] with the element 4 appended to the end of the list.