My problem boils down to finding matching entries in parallel arrays.

Here is a rule that succesfully does just that:

rule "Find matching entry in parallel arrays"
    when
        $first : ArrayList( )
        $second : ArrayList( this != $first )
        $i : Integer( this < $first.size )
        eval( $first.get($i) == $second.get($i) )
    then
        System.out.println ( "Found match at index " + $i + "!" );
end


To execute this rule, I must insert (assert) the two ArrayList facts as well as at least as many Integer facts as there are items in the ArrayLists.

What I don't like about this rule is that

    (1) I have to assert the Integers
    (2) I can't support arbitrarily-sized lists in my rules (without asserting that many Integer facts)

So -- Is there a better way?

What if a future version of Drools supported implicit Number facts that allowed for these kinds of indexing rules?

Aaron