Appending items to a list
There are multiple ways of adding items to a list in groovy. One of them is using the << operator:
def list = []
list << "item"Another is using + or +=:
list += "a" + ["b", "c", "d"]<< is mutating while += is not - it creates a new list.
Last updated
Was this helpful?