There is a new Map-based access path to simplify use of an InfinityDB greatly. The InfinityDBMap and InfinityDBSet classes can wrap a standard database, providing the standard java.util.concurrent.ConcurrentNavigableMap and ..Set interfaces. These standard interfaces are more general than any other standard Map or Set. The java.util.NavigableMap is an improvement over the older java.util.SortedMap.
Use is as simple as this:
Map<String, String> map = new InfinityDBMap<String, String>(db); map.put("key", "hello world!"); System.out.println("value=" + map.get("key")); for (String key : map.keySet()) System.out.println("key=" + key);
This is a vast simplification over the ‘engine’ level, which is still available for speed and compatibility. The documentation mostly covers the original API, but the src/com/infinitydb/map/db/MapHelloWorld.java shows the new mode extensively, including trivial through advanced use patterns such as demo JSON and XML printing. An important idea is the ‘nested Map’ mode, in which a new Map is constructed inside another. See the manual also.
Map<String, String> nestedMap = map.getMap("key"); nestedMap.put("sub_key", "hello world!"); System.out.println("nestedMap: " + nestedMap.get("sub_key"));
The entire proprietary source code for the new API is provided, for reference and documentation purposes. These are in src/com/infinitydb/map/**.
Try it out!