How can I compare the items in two lists and create a new list with the difference in Groovy?
I'd just use the arithmetic operators, I think it's much more obvious what's going on:
def a = ["foo", "bar", "baz", "baz"] def b = ["foo", "qux"] assert ["bar", "baz", "baz", "qux"] == ((a - b) + (b - a))