contains works on the Collection interface. So if parnerList is a ArrayList of String, then you could do:<br><br>parnerList contains &quot;2900&quot;<br><br><div><span class="gmail_quote">On 2/13/07, <b class="gmail_sendername">
jdepaul</b> &lt;<a href="mailto:jjdepaul@us.ibm.com">jjdepaul@us.ibm.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Still having trouble with the contains operator...&nbsp;&nbsp;I have the following rule<br>in place:<br><br><br>rule &quot;Shipper List Match&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$shipperGO : GateOut ( customerId == &quot;Walmart&quot;, partnerList contains
<br>(&quot;2900&quot;) )<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myService.sendNotification($shipperGO, Constants.SHIPPER_MATCH);<br>end<br>--------------------------------------------------------------------------------------------------
<br>and the folllowing code that builds the partnerList collection object:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GateOut walmartGO = new GateOut();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;walmartGO.setCustomerId(&quot;Walmart&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;walmartGO.setContainerId(&quot;2939392&quot;);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;walmartGO.setMatched(false);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;walmartGO.setSourceLocation(&quot;SHGH&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;walmartGO.setDestLocation(&quot;SFCO&quot;);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Partner shipper = new Partner();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;shipper.setPartnerId
(&quot;2900&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;shipper.setPartnerName(&quot;Yellow Freight&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;shipper.setPurpose(Partner.FORWARDER);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HashMap hm = new HashMap();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hm.put(shipper.getPartnerId(), shipper);
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;walmartGO.setPartnerList(hm);<br><br>-----------------------------------------------------------------------<br><br>At runtime, I get the ClassCastException:<br><br>at<br>com.maersk.nam.gems.gatein.walmart.GateOutWalmartExample.main
(GateOutWalmartExample.java:62)<br>Caused by: java.lang.ClassCastException: java.util.HashMap<br><br>Can someone help with the proper expression?<br><br>James<br><br>--<br>View this message in context: <a href="http://www.nabble.com/Example-of-contains-operator...-tf3202978.html#a8935042">
http://www.nabble.com/Example-of-contains-operator...-tf3202978.html#a8935042</a><br>Sent from the drools - user mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<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">https://lists.jboss.org/mailman/listinfo/rules-users
</a><br></blockquote></div><br>