2

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.

Anand
  • 20,708
  • 48
  • 131
  • 198

1 Answers1

4

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

ATMTA
  • 767
  • 6
  • 18