0

I'm using JBoss Drools 5.5.0 rules.

I have an ArrayList<ElementDetail>, and Map<String, ElementDetail>, and I need to do print out all the ElementDetail in ArrayList but not in Map.

class ElementDetail {
    private String name;
    ...
}

ElementDetail class has a name variable which is identified as the Map key.

So far this is what I tried, but it gives no matches:

...
when 
    eleList : List()
    $eleDetail : ElementDetail() from eleList
    $map: Map(myMap.keySet contains $eleDetail.getName())
...

I was able to find similar posts for matching elements in a collection, but it does not get the unmatched elements for a map:

Community
  • 1
  • 1
JackDev
  • 11,003
  • 12
  • 51
  • 68

1 Answers1

4

Well, you'll have to use the negated form of contains, and myMap is not bound.

$eleList : List()
$eleDetail : ElementDetail( $name: name ) from $eleList
$map: Map( keySet not contains $name )
laune
  • 31,114
  • 3
  • 29
  • 42