Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.netfront.net!not-for-mail From: Wanja Gayk Newsgroups: comp.lang.java.programmer Subject: Re: lookup by EnumSet Date: Wed, 29 Feb 2012 11:06:36 +0100 Organization: Netfront http://www.netfront.net/ Lines: 35 Message-ID: References: <3kmpk7lno3fehkr0o21b4dqvhoijmpehbq@4ax.com> NNTP-Posting-Host: 77.8.243.125 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: adenine.netfront.net 1330509995 14187 77.8.243.125 (29 Feb 2012 10:06:35 GMT) X-Complaints-To: news@netfront.net NNTP-Posting-Date: Wed, 29 Feb 2012 10:06:35 +0000 (UTC) User-Agent: MicroPlanet-Gravity/3.0.4 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:12522 In article <3kmpk7lno3fehkr0o21b4dqvhoijmpehbq@4ax.com>, see_website@mindprod.com.invalid says... > > I had a long and annoying dream that there was a Java Collection that > let you look up by EnumSet. It was not a simple Map. > > It worked something like this: You could assign a set of binary > attributes to a Person, e.g. male/female, fat, thin, average, atheist, > Christian, Moslem, Jew, Buddhist. Asian, European, African, North > American, South American.. > > Then you could ask for all the fat or average females, Buddhist but > not Asian. [..] > I wondered how you would do it. Pretty much looks like what databases are made for. Why not use an in- memory-database? You might think that it is overkill, but probably the day will come where you might need some more sophisticated queries, since the demand you sketch above seems to point this way. You could, however, simply go for something like lambdaj or use Predicates with org.apache.commons.collections.CollectionUtils and org.apache.commons.collections.PredicateUtils to solve your problem. Kind regards, Wanja -- ..Alesi's problem was that the back of the car was jumping up and down dangerously - and I can assure you from having been teammate to Jean Alesi and knowing what kind of cars that he can pull up with, when Jean Alesi says that a car is dangerous - it is. [Jonathan Palmer] --- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---