In-memory data structure that supports boolean querying
Posted
by sanity
on Stack Overflow
See other posts from Stack Overflow
or by sanity
Published on 2010-05-20T13:28:24Z
Indexed on
2010/05/20
13:30 UTC
Read the original article
Hit count: 144
I need to store data in memory where I map one or more key strings to an object, as follows:
"green", "blue" -> object1
"red", "yellow" -> object2
I need to be able to efficiently receive a list of objects, where the strings match some boolean criteria, such as:
("red" OR "green") AND NOT "blue"
I'm working in Java, so the ideal solution would be an off-the-shelf Java library. I am, however, willing to implement something from scratch if necessary.
Anyone have any ideas? I'd rather avoid the overhead of an in-memory database if possible, I'm hoping for something comparable in speed to a HashMap (or at least the same order of magnitude).
© Stack Overflow or respective owner