[rules-users] Problem with 'contains'

Wolfgang Laun wolfgang.laun at gmail.com
Sun Oct 30 04:58:19 EDT 2011


java.util.Map does not implement Collection, which ought to be implemented
by the field to which you apply the "contains" operator.

If "contains" works with a Map, it is either a bug or not well defined or
both.

To test whether a string  is a key (or value) in a Map, use
(a) if the string is a field: string memberOf (map.keySet())
(b) eval( map.containsKey(string) )

-W


On 29 October 2011 13:50, hdrews <heinz.drews at gmail.com> wrote:

> I'm using in a rule the 'contains' operator against a Map<String,String>.
> The method 'containsKey' on Map is invoke twice, first with the key then
> with the value associated to the key.
>
> The rule is evaluated to 'false'.
>
> What can I do to prevent this behavior?
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Problem-with-contains-tp3463274p3463274.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20111030/f7deefc5/attachment.html 


More information about the rules-users mailing list