Search code examples
javadata-structureskey-value-store

What's a good java-friendly in-memory map supporting range queries?


I'm looking for an in-memory map with java-friendly APIs (not necessarily java) that supports range queries. Our design doesn't yet call for it to be distributed.

Any suggestions? Thanks!


Solution

  • Use a TreeMap. A range query can be done using the methods lowerEntry and higherEntry, higherKey and lowerKey. Find the first key smaller than the left end of the range, the first key bigger than the right one and return everything between them.