Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2006

Tip: Looking for answers? Try searching our database.

List searching

Thread view: 
alejandrina - 29 Sep 2006 21:13 GMT
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!
Manish Pandit - 30 Sep 2006 07:21 GMT
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
alejandrina - 01 Oct 2006 18:57 GMT
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

> Hi,
>
[quoted text clipped - 8 lines]
> -cheers,
> Manish


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.