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