<br>&nbsp;&nbsp; You should really insert your males and females into your working memory instead of having them as nested lists only. Anyway:<br><br>rule &quot;unlucky male&quot;<br>where<br>&nbsp;&nbsp;&nbsp; $c : City()<br>&nbsp;&nbsp;&nbsp; $m : Male( $age : age ) from $c.maleList<br>
&nbsp;&nbsp;&nbsp; not( Female( age ==$age ) from $c.femaleList )<br>then<br>&nbsp;&nbsp; &nbsp; // $m is unlucky, no female with the same age<br>end<br><br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br>&nbsp;&nbsp;&nbsp; <br><br><div class="gmail_quote">2009/2/2 techy <span dir="ltr">&lt;<a href="mailto:techluver007@gmail.com">techluver007@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Hello,<br>
<br>
Please help me to implement following rule in drool. I could not find a way<br>
to iterate two collection using accumulate or collect in LHS.<br>
<br>
public Male{<br>
 &nbsp;int age;<br>
 &nbsp;//other fields<br>
<br>
}<br>
<br>
public Female{<br>
 &nbsp;int age;<br>
 &nbsp;//other fields<br>
<br>
}<br>
public City{<br>
<br>
&nbsp;private List&lt;Male&gt; &nbsp;maleList;<br>
&nbsp;private List&lt;Female&gt; femaleList;<br>
<br>
}<br>
<br>
#Rule to get all Male whose age != any of female&#39;s<br>
rule &quot;Get Unlucky Male&quot;<br>
when<br>
 &nbsp; &nbsp; &nbsp; &nbsp;city : City()<br>
 &nbsp; &nbsp; &nbsp; &nbsp;maleList : ArrayList() from collect ( Male( his age = any of<br>
Female&#39;s age &nbsp;from city.femaleList &nbsp;) from city.maleList)<br>
//consequence<br>
end<br>
<font color="#888888">--<br>
View this message in context: <a href="http://www.nabble.com/Iterating-two-collection-in-LHS-tp21796713p21796713.html" target="_blank">http://www.nabble.com/Iterating-two-collection-in-LHS-tp21796713p21796713.html</a><br>

Sent from the drools - user mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br> &nbsp;Edson Tirelli<br> &nbsp;JBoss Drools Core Development<br> &nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>