contains works on the Collection interface. So if parnerList is a ArrayList of String, then you could do:<br><br>parnerList contains "2900"<br><br><div><span class="gmail_quote">On 2/13/07, <b class="gmail_sendername">
jdepaul</b> <<a href="mailto:jjdepaul@us.ibm.com">jjdepaul@us.ibm.com</a>> 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... I have the following rule<br>in place:<br><br><br>rule "Shipper List Match"<br> when<br> $shipperGO : GateOut ( customerId == "Walmart", partnerList contains
<br>("2900") )<br><br> then<br> myService.sendNotification($shipperGO, Constants.SHIPPER_MATCH);<br>end<br>--------------------------------------------------------------------------------------------------
<br>and the folllowing code that builds the partnerList collection object:<br><br> GateOut walmartGO = new GateOut();<br> walmartGO.setCustomerId("Walmart");<br> walmartGO.setContainerId("2939392");
<br> walmartGO.setMatched(false);<br> walmartGO.setSourceLocation("SHGH");<br> walmartGO.setDestLocation("SFCO");<br><br> Partner shipper = new Partner();<br> shipper.setPartnerId
("2900");<br> shipper.setPartnerName("Yellow Freight");<br> shipper.setPurpose(Partner.FORWARDER);<br><br> HashMap hm = new HashMap();<br> hm.put(shipper.getPartnerId(), shipper);
<br><br> 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>