What is the closest to ConcurrentHashMap and NavigableMap in Java?

Jacek Furmankiewicz jacek99 at gmail.com
Thu Nov 14 09:36:08 PST 2013


In our Java code, we make heavy use of ConcurrentHashMap for 
in-memory caches:

http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentHashMap.html

We use it mostly for in-memory caches. A background thread wakes 
up every X seconds and resyncs the cache with whatever changes 
occurred in the DB. In the meantime, all the incoming requests 
can read from the same cache without any concurrency issues and 
excellent performance.

All the major Java Map implementations also support the 
NavigableMap interface:

http://docs.oracle.com/javase/7/docs/api/java/util/NavigableMap.html

which allows you to get the key closest to the one you are 
looking for (either up or down). This is very useful when you 
have hierarchies of business rules that have effective date 
ranges and you are trying to find which rules is active on a 
particular day.

I read up the chapter on associative arrays in D, but I do not 
see anything similar to this functionality in there.

Could anyone point me to what would be the closest D equivalents 
(maybe in an external library if not part of Phobos) so we can 
playing around with them?

Much appreciated
Jacek


More information about the Digitalmars-d-learn mailing list