dimanche 24 juillet 2016

subtract List by objid

I have this code in Groovy:

def list1 = [[objid:1, name:"One"], [objid:2, name:"Two"]];
def list2 = [[objid:2, name:"Hello"]];
def list3 = list1 - list2;

println list3;

The output of the code above will result something like this:

[[objid:1, name:One], [objid:2, name:Two]]

QUESTION: How to subtract List by objid? I want the result to be something like this: [[objid:1, name:One]] since objid:2 is present in the List1. How to code it?

Aucun commentaire:

Enregistrer un commentaire