[rules-users] 2 problems with the keyword contains in HashMaps

Wolfgang Laun wolfgang.laun at gmail.com
Thu Oct 11 05:10:12 EDT 2012


The "contains" operator is mapped to the method Collection.contains().

1st question: Map isn't extending this interface, and HashMap does not
implement it. But it's possible to write
    categories_slot1.keySet() contains $cid

2nd question: Evident from the initial statement.

-W


On 11/10/2012, raffi <christian.koehler at s2008.tu-chemnitz.de> wrote:
> Hy.
>
> I have problems, filtering data with the help of /contains/. I have a
> HashMap with /long/-values as keys. In my rules I filter data in the
> following way:
> FilterCriteria(categories_slot1 contains $cid)
>
> HashMap categories_slot1 is initialized with HashMap<Long, Double>. $cid is
> set as long value in the corresponding class, too. Does this work in
> general?
>
> Second problem is that there is another HashMap with Strings as key values.
> FilterCriteria(brands contains $brand)
>
> The problem is, that /brands/-key value strings are not identical to
> $brand.
> But $brand can contain the key value string. But contains only checks if
> they are identical right?
>
> Thanks
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/2-problems-with-the-keyword-contains-in-HashMaps-tp4020210.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
>


More information about the rules-users mailing list