[rules-users] collect return random order

Manukyan, Sergey SManukyan at lear.com
Mon Aug 27 11:06:58 EDT 2007


Folks,

 

When using collect on List of items with some filter (criteria), I need
to have result in the same order as it was received:

 

F.e. I have a list of suppliers : 

 

List()  :   Supplier("FIRST", Status.ACTIVE),  Supplier("SECOND",
Status.INACTIVE), Supplier("THIRD", Status.INACTIVE)

 

And I need to find first INACTIVE supplier, so it must be SECOND
supplier.

 

So doing the following : 

 

 

When 

$l : List()  // list of suppliers

$inactive_supp : ArrayList() from collect Supplier(status ==
Status.INACTIVE) from $l

Then

            System.out.println($l); // prints FIRST, SECOND, THIRD

System.out.println($inactive_supp);  // prints THIRD, SECOND  ....
Instead of SECOND , THIRD

 

 

So I am getting THIRD supplier instead of SECOND as the result..

 

Please advise if it is a bug .., or there is another way of doing
that...

 

Thanks,

 

-Sergey

 

 

 



**********************
** LEGAL DISCLAIMER **
**********************

This E-mail message and any attachments may contain 
legally privileged, confidential or proprietary 
information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of 
this message to the intended recipient(s), you are 
hereby notified that any dissemination, distribution 
or copying of this E-mail message is strictly 
prohibited. If you have received this message in 
error, please immediately notify the sender and 
delete this E-mail message from your computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070827/9929c300/attachment.html 


More information about the rules-users mailing list