File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Filtering a list of Beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Filtering a list of Beans" Watch "Filtering a list of Beans" New topic

Filtering a list of Beans

Nick Delauney
Ranch Hand

Joined: Sep 28, 2002
Posts: 43
Hi All,

I am trying to figure out a way to generically filter a List of beans (assume list contains objects of the same type). I am thinking that I need to create a filter string and have the list parse and match the objects in the list against the filter.

Has anyone done this before, or can help in anyway?


N.D:"Anything worth having, takes time to get"
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Describe what you mean by filter string or show us what you've tried. If you want to always filter all widgets with price < 10.00 that's pretty easy. If you want the user to enter expressions so the string looks like "price < 10.00" or "quantity > 5" things get a bit trickier.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: Filtering a list of Beans
It's not a secret anymore!