-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Counting an objects collection (with filter) without loading
PostPosted: Wed Aug 11, 2010 10:58 am 
Newbie

Joined: Sun Mar 27, 2005 1:22 pm
Posts: 15
Looking for advice on this and it's best if I present an example to explain...

I have a ShoppingCart object that holds many Items.

The item object has a flag isPerishable

When I get the object ShoppingCart I would like to know how many Item objects it holds are of type isPerishable, the only way I know how to do that it is to add a howManyIsPerishable() method to the ShoppingCart object and loop over the Items and count on the isPerishable flag.

Is there a more intelligent way of doing this?

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.