Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #12522

Re: lookup by EnumSet

From Wanja Gayk <brixomatic@yahoo.com>
Newsgroups comp.lang.java.programmer
Subject Re: lookup by EnumSet
Date 2012-02-29 11:06 +0100
Organization Netfront http://www.netfront.net/
Message-ID <MPG.29b81607431ef1f29896f8@202.177.16.121> (permalink)
References <3kmpk7lno3fehkr0o21b4dqvhoijmpehbq@4ax.com>

Show all headers | View raw


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 ---

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar


Thread

lookup by EnumSet Roedy Green <see_website@mindprod.com.invalid> - 2012-02-28 05:55 -0800
  Re: lookup by EnumSet Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-02-28 07:03 -0800
    Re: lookup by EnumSet Roedy Green <see_website@mindprod.com.invalid> - 2012-02-28 15:22 -0800
  Re: lookup by EnumSet Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-02-28 09:27 -0600
    Re: lookup by EnumSet Lew <noone@lewscanon.com> - 2012-02-28 09:31 -0800
      Re: lookup by EnumSet Robert Klemme <shortcutter@googlemail.com> - 2012-02-28 23:08 +0100
  Re: lookup by EnumSet Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-28 08:51 -0800
  Re: lookup by EnumSet Robert Klemme <shortcutter@googlemail.com> - 2012-02-28 23:08 +0100
    Re: lookup by EnumSet Robert Klemme <shortcutter@googlemail.com> - 2012-03-01 01:22 -0800
  Re: lookup by EnumSet Wanja Gayk <brixomatic@yahoo.com> - 2012-02-29 11:06 +0100

csiph-web