I have 2 lists eg ListA[1,2,3,4] and ListB[2,3]. I need to compare both and create a new list with the values that are not found in ListB (i.e. ListC[1,4]).
You might try doing it like this:
def l1 = ["1", "2", "3", "4"]
def l2 = ["2", "3"]
def commons = l1.intersect(l2)
def difference = l1.plus(l2)
difference.removeAll(commons)
return difference
See image for result.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.