rule &quot;get big shapes by color&quot;<br>when<br>  $map: Map()<br>    from accumulate ( $shape: Shapes( $color: color, size &gt; 5 ),<br>      init( Map m = new HashMap(); ),<br>      action( List list = m.get( $color );<br>
                 if( list == null ) list = new ArrayList();<br>                 list.add( shape ); ),<br>      result( m ) )<br>then<br>   // process $map to get all lists of same color<br>end<br><br>Untested.<br><br>-W<br>
<br><div class="gmail_quote">On 10 August 2011 17:20, wendy <span dir="ltr">&lt;<a href="mailto:w.mungovan@yahoo.com">w.mungovan@yahoo.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
  I&#39;m trying to write the following rule but am having some trouble.<br>
<br>
  We have a object say Shape and which has attributes size and color.  I<br>
want to get a list of all shapes with the same color that have size &gt; 5.<br>
How can I make sure the color is the same for all objects in the collect<br>
without having different rules for &#39;red&#39;, &#39;green&#39;...?<br>
<br>
Thank you,<br>
Wendy<br>
<font color="#888888"><br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Collect-with-same-value-tp3242904p3242904.html" target="_blank">http://drools.46999.n3.nabble.com/Collect-with-same-value-tp3242904p3242904.html</a><br>

Sent from the Drools: User forum mailing list archive at Nabble.com.<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>