I was using ArrayList before and I don&#39;t think this is the real problem. collect() will return object compatible with List interface so it is valid to use size() and get() methods on $removeUs.<div>I have helper method myhelper.log() with accepts any object and <b>myhelper.log($removeUs.get(i))</b> works for me, unfortunately <b>retract($removeUs.get(i)) </b>doesn&#39;t work with error:</div>
<div><br></div><div><font color="#333333" face="arial, tahoma, verdana, sans-serif"><span style="font-size:14px">Error: unable to resolve method using strict-mode: org.drools.spi.KnowledgeHelper.drools()] [Near : {... drools.retract($removeUs ....}]</span></font></div>
<div><br></div><div>It looks like it is not even compiled.</div><div><br><div class="gmail_quote">2012/11/30 Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 30/11/2012, Martin Minka &lt;<a href="mailto:martin.minka@gmail.com">martin.minka@gmail.com</a>&gt; wrote:<br>
&gt; Thank you for the tip. What solution would you suggest to solve my problem<br>
&gt; ?<br>
<br>
Look into the javadoc of java.util to find any class implementing List :-)<br>
-W<br>
<br>
&gt;<br>
&gt; Martin<br>
&gt;<br>
&gt;<br>
&gt; 2012/11/30 Wolfgang Laun &lt;<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>&gt;<br>
&gt;<br>
&gt;&gt; You cannot use an interfact (List) to instantiate an object, which<br>
&gt;&gt; is happening due to the collect.<br>
&gt;&gt; --W<br>
&gt;&gt;<br>
&gt;&gt; On 30/11/2012, Martin Minka &lt;<a href="mailto:martin.minka@gmail.com">martin.minka@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt; I want to keep only 1 fact with id==&quot;aaaa&quot;. But this is not working:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; rule &quot;leave only one&quot;<br>
&gt;&gt; &gt; when<br>
&gt;&gt; &gt;     $removeUs : java.util.List(size&gt;1)<br>
&gt;&gt; &gt;         from collect(Fact(id==&quot;aaaa&quot;)<br>
&gt;&gt; &gt; then<br>
&gt;&gt; &gt;     size = $removeUs.size();<br>
&gt;&gt; &gt;     for (int i=1; i &lt; size; i++) {<br>
&gt;&gt; &gt;         retract($removeUs.get(i));<br>
&gt;&gt; &gt;     }<br>
&gt;&gt; &gt; end<br>
&gt;&gt; &gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; rules-users mailing list<br>
&gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt;<br>
&gt;<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>
</blockquote></div><br></div>