Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > List searching

Reply
Thread Tools

List searching

 
 
alejandrina
Guest
Posts: n/a
 
      09-29-2006
Hi all,

I have a list (ArrayList but can be anything that helps the cause) of
objects. I'd love to find a way of extracting all elements that match a
given criteria into another list. I know how to do this manually, but I
was hoping it already existed, maybe in a library with other cool
useful stuff. I looked at the Jakarta Commons Collections, but no luck.
Any suggestions?

Thanks!

 
Reply With Quote
 
 
 
 
Manish Pandit
Guest
Posts: n/a
 
      09-30-2006
Hi,

What kind of criteria? I mean, is that like a list of numbers and you
want to get a range of numbers pulled out? Or are they POJOs like a
'Person' where you want to pull out all persons 'where firstName like
'Pete', pretty much using it like a database?

You can take a look at SortedSet's subSet( ) method if that is in line
with your direction.

-cheers,
Manish

 
Reply With Quote
 
 
 
 
alejandrina
Guest
Posts: n/a
 
      10-01-2006
Yes, that's certainly useful. What would be MOST useful would be
something like:

List result = list.findAll (method)

where method is the selector. Haven't seen this anywhere...

Thanks,

Alejandrina


Manish Pandit wrote:
> Hi,
>
> What kind of criteria? I mean, is that like a list of numbers and you
> want to get a range of numbers pulled out? Or are they POJOs like a
> 'Person' where you want to pull out all persons 'where firstName like
> 'Pete', pretty much using it like a database?
>
> You can take a look at SortedSet's subSet( ) method if that is in line
> with your direction.
>
> -cheers,
> Manish


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Google search result to be URL-limited when searching site, but notwhen searching Web stumblng.tumblr Javascript 1 02-04-2008 09:01 AM
searching a list of dictionaries for an element in a list. Odd-R. Python 2 08-10-2005 01:13 PM
Searching Point x/y in a ordered List michael Rogowski C++ 1 07-22-2004 07:17 PM
searching within a Select html list Robert Computer Support 2 02-15-2004 05:12 PM
Ad Shield - searching blocked list Ima Goodlay Computer Support 2 09-11-2003 10:04 PM



Advertisments