to check if an Object is present in List in Drools

10,496

Try memberOf operator
From Drools Rule Language Documentation

The operator memberOf is used to check whether a field is a member of a collection or array; that collection must be a variable. Blockquote

Share:
10,496
Anand
Author by

Anand

Java/J2EE developer

Updated on June 04, 2022

Comments

  • Anand
    Anand about 2 years

    I am newbie in Drools and given the work to write rule files i.e. drl files. I am facing one issue.

    The operator contains is used to check whether a field that is a Collection or array contains the specified value.

    Object( objList contains "bye" ) -- to verify if "bye' is there in objList or not i.e. for verifying String.

    But, I have List of Objects and want to check if List contains any particular Object or not so I used the above replacing String with an object but that didn't work.'

    Can someone please help me.